Skip to content

Commit 8253404

Browse files
committed
feat(docs): add observability logging baseline and update related documentation across multiple languages
1 parent 1345531 commit 8253404

File tree

9 files changed

+33
-37
lines changed

9 files changed

+33
-37
lines changed

.github/instructions/includes/observability-logging-baseline.include.md renamed to .github/instructions/includes/observability-baseline.include.md

File renamed without changes.

.github/instructions/python.instructions.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -547,26 +547,26 @@ For CLIs:
547547
- [PY-OBS-012] Structured logging (JSON) should be available when useful:
548548
- [PY-OBS-012a] `--log-format json` (or equivalent)
549549
- [PY-OBS-012b] `--log-level` (INFO/WARNING/ERROR/DEBUG)
550-
- [PY-OBS-013] When emitting structured output, include the CLI invocation fields defined in the [Structured Logging Baseline](./includes/observability-logging-baseline.include.md#2-required-fields-clis) and never log secrets, tokens, credentials, or raw personal data.
550+
- [PY-OBS-013] When emitting structured output, include the CLI invocation fields defined in the [Structured Logging Baseline](./includes/observability-baseline.include.md#2-required-fields-clis) and never log secrets, tokens, credentials, or raw personal data.
551551
- [PY-OBS-014] Prefer event-style logs with stable names:
552552
- [PY-OBS-014a] `command.start`, `command.end`, `step.start`, `step.end`, `dependency.call`, `dependency.error`
553553

554554
For APIs (mandatory structured logging):
555555

556556
Logs must be structured (prefer JSON), queryable, and consistent.
557557

558-
- [PY-OBS-015] Service/API logs must include the required fields defined in the [Structured Logging Baseline](./includes/observability-logging-baseline.include.md#1-required-fields-services-apis); do not fork or trim that list locally.
558+
- [PY-OBS-015] Service/API logs must include the required fields defined in the [Structured Logging Baseline](./includes/observability-baseline.include.md#1-required-fields-services-apis); do not fork or trim that list locally.
559559
- [PY-OBS-016] HTTP metadata (method, path template, status code) and timing/outcome fields from the baseline are mandatory for every request log entry.
560-
- [PY-OBS-017] Apply the baseline secrecy rules ([section 3](./includes/observability-logging-baseline.include.md#3-sensitive-data--secrecy-rules)): never log secrets, credentials, or raw personal data; mask or truncate payloads when logging is explicitly required.
561-
- [PY-OBS-018] Use the baseline event taxonomy ([section 4](./includes/observability-logging-baseline.include.md#4-event-naming--taxonomy)) so request/dependency events stay searchable across repos.
560+
- [PY-OBS-017] Apply the baseline secrecy rules ([section 3](./includes/observability-baseline.include.md#3-sensitive-data--secrecy-rules)): never log secrets, credentials, or raw personal data; mask or truncate payloads when logging is explicitly required.
561+
- [PY-OBS-018] Use the baseline event taxonomy ([section 4](./includes/observability-baseline.include.md#4-event-naming--taxonomy)) so request/dependency events stay searchable across repos.
562562
- [PY-OBS-019] Prefer high-signal logs only:
563563
- [PY-OBS-019a] start/end of request (one each)
564564
- [PY-OBS-019b] key domain decision points (not every line)
565565
- [PY-OBS-019c] boundary calls (DB, AWS, HTTP)
566566
- [PY-OBS-019d] errors (once, with structured context)
567-
- [PY-OBS-019e] When `DEBUG`/diagnostic logging is enabled, emit a single function/method entry log for every call path, capturing the operation name and a sanitised summary of arguments per the [Structured Logging Baseline §5](./includes/observability-logging-baseline.include.md#5-diagnostics--sampling); never include sensitive data.
567+
- [PY-OBS-019e] When `DEBUG`/diagnostic logging is enabled, emit a single function/method entry log for every call path, capturing the operation name and a sanitised summary of arguments per the [Structured Logging Baseline §5](./includes/observability-baseline.include.md#5-diagnostics--sampling); never include sensitive data.
568568

569-
Log level policy (see also [§5.1 of the baseline](./includes/observability-logging-baseline.include.md#51-log-level-hierarchy)):
569+
Log level policy (see also [§5.1 of the baseline](./includes/observability-baseline.include.md#51-log-level-hierarchy)):
570570

571571
- [PY-OBS-020] `DEBUG`: diagnostic level that **includes trace-like function/method entry logging** (Python's stdlib `logging` lacks a distinct `TRACE` level); only for local/dev or explicitly enabled diagnostics (never required in normal production operation)
572572
- [PY-OBS-021] `INFO`: normal request lifecycle and major domain events

.github/instructions/rust.instructions.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ For Rust CLIs, follow the [CLI Contract](./includes/cli-contract-baseline.includ
199199

200200
## 9. Observability 🔭
201201

202-
For Rust services and CLIs that produce structured logs, follow the [Structured Logging Baseline](./includes/observability-logging-baseline.include.md).
202+
For Rust services and CLIs that produce structured logs, follow the [Structured Logging Baseline](./includes/observability-baseline.include.md).
203203

204204
### 9.1 Tooling
205205

@@ -209,23 +209,23 @@ For Rust services and CLIs that produce structured logs, follow the [Structured
209209

210210
### 9.2 Required fields
211211

212-
- [RS-OBS-004] Service/API logs must include the required fields from [§1 of the baseline](./includes/observability-logging-baseline.include.md#1-required-fields-services-apis-async-workers): `service`, `version`, `environment`, `request_id`, `operation`, `duration_ms`, and `error_code` (on failure).
213-
- [RS-OBS-005] CLI logs must include the required fields from [§2 of the baseline](./includes/observability-logging-baseline.include.md#2-required-fields-clis): `command`, `args` (sanitised), `exit_code`, `duration_ms`.
212+
- [RS-OBS-004] Service/API logs must include the required fields from [§1 of the baseline](./includes/observability-baseline.include.md#1-required-fields-services-apis-async-workers): `service`, `version`, `environment`, `request_id`, `operation`, `duration_ms`, and `error_code` (on failure).
213+
- [RS-OBS-005] CLI logs must include the required fields from [§2 of the baseline](./includes/observability-baseline.include.md#2-required-fields-clis): `command`, `args` (sanitised), `exit_code`, `duration_ms`.
214214

215215
### 9.3 Secrecy and safety
216216

217-
- [RS-OBS-006] Apply the secrecy rules from [§3 of the baseline](./includes/observability-logging-baseline.include.md#3-sensitive-data--secrecy-rules): never log secrets, tokens, or raw personal data.
217+
- [RS-OBS-006] Apply the secrecy rules from [§3 of the baseline](./includes/observability-baseline.include.md#3-sensitive-data--secrecy-rules): never log secrets, tokens, or raw personal data.
218218
- [RS-OBS-007] Use `tracing`'s `skip` or `skip_all` in `#[instrument]` to exclude sensitive fields from spans.
219219
- [RS-OBS-008] When logging payloads, truncate large bodies and mark with `truncated=true`.
220220

221221
### 9.4 Event taxonomy
222222

223-
- [RS-OBS-009] Use the event taxonomy from [§4 of the baseline](./includes/observability-logging-baseline.include.md#4-event-naming--taxonomy): stable names like `request.start`, `request.end`, `dependency.call`, `dependency.error`.
223+
- [RS-OBS-009] Use the event taxonomy from [§4 of the baseline](./includes/observability-baseline.include.md#4-event-naming--taxonomy): stable names like `request.start`, `request.end`, `dependency.call`, `dependency.error`.
224224
- [RS-OBS-010] Emit both start and end spans/events around expensive boundaries (HTTP calls, DB queries, filesystem IO).
225225

226226
### 9.5 Diagnostics
227227

228-
- [RS-OBS-011] Default to `info` level; enable `debug`/`trace` only via explicit configuration (`RUST_LOG` or application config). Use `trace` for function/method entry logging (per [§5.1 of the baseline](./includes/observability-logging-baseline.include.md#51-log-level-hierarchy)) and `debug` for coarser diagnostic messages.
228+
- [RS-OBS-011] Default to `info` level; enable `debug`/`trace` only via explicit configuration (`RUST_LOG` or application config). Use `trace` for function/method entry logging (per [§5.1 of the baseline](./includes/observability-baseline.include.md#51-log-level-hierarchy)) and `debug` for coarser diagnostic messages.
229229
- [RS-OBS-012] Every exception must trigger exactly one `error!` log entry with `error_code` and correlation identifiers, even if the software can recover.
230230
- [RS-OBS-013] When `trace` level is enabled, use `#[instrument(level = "trace")]` on all public functions and async boundaries to emit function entry spans automatically.
231231

@@ -281,7 +281,7 @@ Before shipping Rust code, verify:
281281
- [RS-CHK-008] No `unwrap()` in library code; justified only in binaries
282282
- [RS-CHK-009] No anti-patterns from §12 are present
283283
- [RS-CHK-010] Code passes `cargo fmt`, `cargo clippy`, `cargo test`, `cargo doc`
284-
- [RS-CHK-011] Structured logs follow the [Observability Logging Baseline](./includes/observability-logging-baseline.include.md)
284+
- [RS-CHK-011] Structured logs follow the [Observability Logging Baseline](./includes/observability-baseline.include.md)
285285
- [RS-CHK-012] CLI binaries follow the [CLI Contract](./includes/cli-contract-baseline.include.md) for exit codes and streams
286286

287287
---

.github/instructions/terraform.instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ Logging must be intentional, queryable, and safe.
516516
**Operational rules:**
517517

518518
- [TF-OBS-020] Prefer structured logs (JSON) for application logs; avoid free-text-only logs.
519-
- [TF-OBS-020a] Application logs emitted by Lambda functions, ECS containers, and similar compute must follow the [Structured Logging Baseline](./includes/observability-logging-baseline.include.md) field requirements — this is an infrastructure concern because log retention, parsing, and alerting depend on consistent schemas.
519+
- [TF-OBS-020a] Application logs emitted by Lambda functions, ECS containers, and similar compute must follow the [Structured Logging Baseline](./includes/observability-baseline.include.md) field requirements — this is an infrastructure concern because log retention, parsing, and alerting depend on consistent schemas.
520520
- [TF-OBS-021] Ensure logs include correlation identifiers consistently (request id / trace id / account id / region).
521521
- [TF-OBS-022] Use CloudWatch Logs Insights-friendly fields and stable event names.
522522

.github/instructions/typescript.instructions.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ If the system depends on external services (cloud APIs, databases, third-party s
565565

566566
### 11.6 Debugging modes 🪲
567567

568-
- [TS-ERR-017] Support controlled diagnostics (see also [§5.1 of the baseline](./includes/observability-logging-baseline.include.md#51-log-level-hierarchy) for level hierarchy):
568+
- [TS-ERR-017] Support controlled diagnostics (see also [§5.1 of the baseline](./includes/observability-baseline.include.md#51-log-level-hierarchy) for level hierarchy):
569569
- [TS-ERR-017a] `--verbose` increases detail (CLIs)
570570
- [TS-ERR-017b] `--debug` may include stack traces and enables function/method entry logging (trace-like behaviour; still never secrets)
571571
- [TS-ERR-018] Diagnostics must not change behaviour, only observability.
@@ -592,11 +592,11 @@ Observability is non-negotiable.
592592

593593
### 12.2 Logging
594594

595-
- [TS-OBS-004] Prefer structured logs (JSON) and follow the [Structured Logging Baseline](./includes/observability-logging-baseline.include.md) for canonical field definitions.
596-
- [TS-OBS-005] Service/API logs must include the required metadata from [section 1](./includes/observability-logging-baseline.include.md#1-required-fields-services-apis); do not remove or rename those fields locally.
597-
- [TS-OBS-006] CLI/worker logs that emit structured output must include the CLI invocation fields from [section 2](./includes/observability-logging-baseline.include.md#2-required-fields-clis).
598-
- [TS-OBS-007] Apply the secrecy and event taxonomy rules from [sections 3–4](./includes/observability-logging-baseline.include.md#3-sensitive-data--secrecy-rules); never log secrets or personal data, and keep event names (`request.*`, `dependency.*`, etc.) stable for automation.
599-
- [TS-OBS-007a] When verbose or debug logging is enabled, emit a single function/method entry log for every call path with the operation name and a sanitised summary of arguments per [section 5](./includes/observability-logging-baseline.include.md#5-diagnostics--sampling); never include sensitive payloads.
595+
- [TS-OBS-004] Prefer structured logs (JSON) and follow the [Structured Logging Baseline](./includes/observability-baseline.include.md) for canonical field definitions.
596+
- [TS-OBS-005] Service/API logs must include the required metadata from [section 1](./includes/observability-baseline.include.md#1-required-fields-services-apis); do not remove or rename those fields locally.
597+
- [TS-OBS-006] CLI/worker logs that emit structured output must include the CLI invocation fields from [section 2](./includes/observability-baseline.include.md#2-required-fields-clis).
598+
- [TS-OBS-007] Apply the secrecy and event taxonomy rules from [sections 3–4](./includes/observability-baseline.include.md#3-sensitive-data--secrecy-rules); never log secrets or personal data, and keep event names (`request.*`, `dependency.*`, etc.) stable for automation.
599+
- [TS-OBS-007a] When verbose or debug logging is enabled, emit a single function/method entry log for every call path with the operation name and a sanitised summary of arguments per [section 5](./includes/observability-baseline.include.md#5-diagnostics--sampling); never include sensitive payloads.
600600

601601
### 12.3 Metrics
602602

.github/prompts/dev.implement-cli-args-parsing.prompt.md

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ description: Evaluate and enforce specific CLI argument parsing discipline acros
66

77
## Goal 🎯
88

9-
Audit every CLI entrypoint and argument parser in this repository against the CLI Contract Baseline and the argument parsing standards defined below. For each entrypoint, report compliance or non-compliance per category, citing concrete evidence (function names, line numbers, code snippets). Where gaps exist, implement fixes immediately using the sensible defaults described in this prompt and the baseline.
9+
Review every CLI entrypoint and argument parser against the CLI standards below. Report compliance with evidence and fix gaps using the defaults in this prompt and the baseline.
1010

1111
## Steps 👣
1212

@@ -25,21 +25,11 @@ Audit every CLI entrypoint and argument parser in this repository against the CL
2525
2. Flag manual parsing (`sys.argv`, `os.Args`, `process.argv`) or ad-hoc split logic that bypasses a parser.
2626
3. Record where validation and default handling occur.
2727

28-
### Step 3: Assess compliance
28+
### Step 3: Assess CLI contract baseline compliance
2929

30-
Evaluate each CLI against the CLI Contract Baseline at:
30+
Use it for context and evaluate each CLI against the CLI Contract Baseline:
3131

32-
- `.github/instructions/includes/cli-contract-baseline.include.md`
33-
34-
Report compliance for:
35-
36-
- Exit codes
37-
- Stdout vs stderr
38-
- Documentation and testing expectations
39-
- Developer ergonomics
40-
- Wrappers and shared libraries
41-
- Cloud and serverless workloads (where relevant)
42-
- Argument parsing and flags
32+
- [.github/instructions/includes/cli-contract-baseline.include.md](../instructions/includes/cli-contract-baseline.include.md)
4333

4434
### Step 4: Remediate
4535

.github/prompts/dev.implement-logging.prompt.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ description: Evaluate and enforce specific logging discipline across the codebas
66

77
## Goal 🎯
88

9-
Audit every Python file in this repository against the logging standards defined below. For each file, report compliance or non-compliance per category, citing concrete evidence (function names, line numbers, code snippets). Where gaps exist, implement fixes immediately using the sensible defaults described in this prompt.
9+
Review every Python file against the logging standards below. Report compliance with evidence and fix gaps using the defaults in this prompt and the baseline.
1010

1111
## Steps 👣
1212

@@ -25,6 +25,12 @@ Audit every Python file in this repository against the logging standards defined
2525

2626
For every file that uses logging (or should but does not), evaluate compliance against the categories below. Report each finding and remediate inline where feasible.
2727

28+
### Step 3: Assess observability baseline compliance
29+
30+
Use it for context and evaluate each runtime that emits structured logs against the Observability Baseline:
31+
32+
- [.github/instructions/includes/observability-baseline.include.md](../instructions/includes/observability-baseline.include.md)
33+
2834
## Implementation requirements 🛠️
2935

3036
### Anti-patterns (flag and fix immediately) 🚫

.github/skills/django-project/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Mandatory reads (must be loaded before using this skill):
1414
- [Python instructions](../../instructions/python.instructions.md) — use its identifiers when describing compliance.
1515
- [Local-first dev baseline](../../instructions/includes/local-first-dev-baseline.include.md)
1616
- [Quality gates baseline](../../instructions/includes/quality-gates-baseline.include.md)
17-
- [Observability logging baseline](../../instructions/includes/observability-logging-baseline.include.md)
17+
- [Observability logging baseline](../../instructions/includes/observability-baseline.include.md)
1818
- [AI-assisted change baseline](../../instructions/includes/ai-assisted-change-baseline.include.md)
1919

2020
## Inputs to confirm ✅

.github/skills/fastapi-project/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Mandatory reads (must be loaded before using this skill):
1414
- [Python instructions](../../instructions/python.instructions.md) — use its identifiers when describing compliance.
1515
- [Local-first dev baseline](../../instructions/includes/local-first-dev-baseline.include.md)
1616
- [Quality gates baseline](../../instructions/includes/quality-gates-baseline.include.md)
17-
- [Observability logging baseline](../../instructions/includes/observability-logging-baseline.include.md)
17+
- [Observability logging baseline](../../instructions/includes/observability-baseline.include.md)
1818
- [AI-assisted change baseline](../../instructions/includes/ai-assisted-change-baseline.include.md)
1919

2020
## Inputs to confirm ✅

0 commit comments

Comments
 (0)