Skip to content

Add stdout diagnostics OTEL log exporter#94561

Merged
jesse-merhi merged 7 commits into
mainfrom
jesse-merhi/want-read-implement-tmp
Jun 19, 2026
Merged

Add stdout diagnostics OTEL log exporter#94561
jesse-merhi merged 7 commits into
mainfrom
jesse-merhi/want-read-implement-tmp

Conversation

@jesse-merhi

@jesse-merhi jesse-merhi commented Jun 18, 2026

Copy link
Copy Markdown
Member

Summary

  • Add diagnostics.otel.logsExporter with otlp, stdout, and both modes while keeping OTLP as the default.
  • Route stdout JSONL through the same diagnostics-otel log-record build path as OTLP, including redaction, content-capture rules, attribute filtering, security events, and trusted trace fields.
  • Add QA Lab smoke coverage for stdout-only and dual OTLP+stdout log export.

What Changed

  • extensions/diagnostics-otel/src/service.ts now builds each diagnostic log record once and sends it to the selected sink: OTLP, stdout JSONL, or both.
  • Stdout-only logs no longer depend on the OTLP protocol setting when traces, metrics, and OTLP logs are off.
  • src/config/* and generated config docs now expose diagnostics.otel.logsExporter.
  • test/e2e/qa-lab/runtime/qa-otel-smoke-runtime.ts maps --logs-exporter to a matching QA scenario and rejects explicit mismatches.
  • Custom --scenario values still work; only mismatches among the built-in OTEL smoke scenarios are rejected.
  • qa/scenarios/runtime/otel-stdout-log-smoke.yaml and qa/scenarios/runtime/otel-both-log-smoke.yaml preserve sanitized gateway stdout artifacts so the wrapper can verify real emitted JSONL records.

Proof

Evidence Claim Proved Result
node --import tsx test/e2e/qa-lab/runtime/qa-otel-smoke-runtime.ts --logs-exporter stdout --output-dir .artifacts/native-review-otel-stdout-custom-scenario-fix Default stdout smoke path selects the stdout scenario, emits stdout diagnostics logs, keeps traces/metrics on OTLP, and sends no OTLP logs. Passed with spans=17, metrics=24, logs=0, stdoutLogs=16, traces=3, metricRequests=5, logRequests=0.
node --import tsx test/e2e/qa-lab/runtime/qa-otel-smoke-runtime.ts --logs-exporter both --output-dir .artifacts/native-review-otel-both-scenario-fix Dual exporter mode emits the same diagnostics logs to OTLP and stdout. Passed with spans=17, metrics=24, logs=16, stdoutLogs=16, traces=3, metricRequests=5, logRequests=4.
Focused diagnostics/config/QA Vitest run Unit coverage protects stdout-only, OTLP-only, both-sink behavior, security-event stdout export, config parsing, generated schema, scenario catalog, smoke-runner assertions, and custom scenario overrides. Passed 5 Vitest shards: 23 + 90 + 26 + 95 + 46 tests.
Generated config checks Generated config schema and docs baseline match the new config field. generate-base-config-schema --check and generate-config-doc-baseline --check passed.
Format/lint/type checks Changed TypeScript and QA scenario files are formatted, linted, and type-safe in the affected lanes. oxfmt, oxlint, tsgo extension/test lanes, and git diff --check passed.

Verification

node scripts/run-vitest.mjs extensions/diagnostics-otel/src/service.test.ts test/e2e/qa-lab/runtime/qa-otel-smoke.e2e.test.ts extensions/qa-lab/src/scenario-catalog.test.ts extensions/qa-lab/src/suite-planning.test.ts src/config/config-misc.test.ts src/config/schema.help.quality.test.ts
node --import tsx test/e2e/qa-lab/runtime/qa-otel-smoke-runtime.ts --logs-exporter stdout --output-dir .artifacts/native-review-otel-stdout-custom-scenario-fix
node --import tsx test/e2e/qa-lab/runtime/qa-otel-smoke-runtime.ts --logs-exporter both --output-dir .artifacts/native-review-otel-both-scenario-fix
node --import tsx scripts/generate-base-config-schema.ts --check
node --import tsx scripts/generate-config-doc-baseline.ts --check
pnpm exec oxfmt --check --threads=1 extensions/diagnostics-otel/src/service.ts extensions/diagnostics-otel/src/service.test.ts test/e2e/qa-lab/runtime/qa-otel-smoke-runtime.ts test/e2e/qa-lab/runtime/qa-otel-smoke.e2e.test.ts qa/scenarios/runtime/otel-both-log-smoke.yaml
node scripts/run-oxlint.mjs extensions/diagnostics-otel/src/service.ts extensions/diagnostics-otel/src/service.test.ts test/e2e/qa-lab/runtime/qa-otel-smoke-runtime.ts test/e2e/qa-lab/runtime/qa-otel-smoke.e2e.test.ts
node scripts/run-tsgo.mjs -p tsconfig.extensions.json
node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.json
node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.extensions.test.json
git diff --check

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime extensions: diagnostics-otel Extension: diagnostics-otel extensions: qa-lab size: L maintainer Maintainer-authored PR labels Jun 18, 2026
@clawsweeper

clawsweeper Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed June 19, 2026, 1:57 AM ET / 05:57 UTC.

Summary
The PR adds diagnostics.otel.logsExporter with OTLP/stdout/both modes, emits redacted diagnostics logs to stdout JSONL, and updates config docs/schema plus QA Lab smoke coverage.

PR surface: Source +100, Tests +658, Docs +14, Config 0, Generated 0, Other +206. Total +978 across 27 files.

Reproducibility: not applicable. as a bug reproduction; this is a feature PR. The relevant behavior evidence is after-patch terminal QA Lab proof for stdout-only and dual exporter modes plus focused tests.

Review metrics: 1 noteworthy metric.

  • Public config surface: 1 added, 0 changed, 0 removed. diagnostics.otel.logsExporter becomes an operator-facing diagnostics setting, so maintainers should explicitly accept the support contract before merge.

Stored data model
Persistent data-model change detected: serialized state: extensions/diagnostics-otel/src/service.ts, serialized state: test/e2e/qa-lab/runtime/qa-otel-smoke-runtime.ts. Confirm migration or upgrade compatibility proof before merge.

Merge readiness
Overall: 🦞 diamond lobster
Proof: 🦞 diamond lobster
Patch quality: 🦞 diamond lobster
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Risk before merge

  • [P1] Merging establishes diagnostics.otel.logsExporter and the stdout JSONL diagnostic record shape as operator-facing support and privacy contracts; the OTLP default preserves current behavior, but CI cannot decide whether maintainers want that new public surface.

Maintainer options:

  1. Accept stdout diagnostics as supported (recommended)
    A maintainer can approve the new diagnostics.otel.logsExporter option and stdout JSONL record shape as supported operator behavior before merge.
  2. Narrow the public surface first
    If the config contract is too much for this release, remove or gate logsExporter and keep only implementation pieces maintainers are ready to support.
  3. Pause for observability direction
    Pause or close the PR if stdout diagnostics export should wait for a broader observability policy decision.

Next step before merge

  • [P2] Manual review is required because this protected maintainer PR adds a public diagnostics config/operator contract rather than a narrow automated repair blocker.

Security
Cleared: No concrete security or supply-chain concern was found; the diff adds no dependencies, workflows, lockfiles, install hooks, or secret handling and keeps stdout records on the existing redaction path.

Review details

Best possible solution:

Merge after maintainers explicitly accept the new diagnostics config/log-shape contract, with OTLP preserved as the default and the shared redaction plus QA proof kept intact.

Do we have a high-confidence way to reproduce the issue?

Not applicable as a bug reproduction; this is a feature PR. The relevant behavior evidence is after-patch terminal QA Lab proof for stdout-only and dual exporter modes plus focused tests.

Is this the best way to solve the issue?

Yes, pending maintainer product acceptance; the runtime change stays inside the diagnostics-otel owner boundary and reuses the existing redacted log-record builder instead of adding a parallel sanitizer.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 82ae81f3bf1d.

Label changes

Label changes:

  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

  • P2: This is a bounded diagnostics/config feature with strong proof and limited blast radius, not an outage, security emergency, or broken live workflow.
  • merge-risk: 🚨 compatibility: The PR adds a public diagnostics config key and stdout telemetry output shape that operators may depend on after release.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body includes after-patch terminal QA Lab runs for stdout-only and dual exporter modes with expected OTLP/stdout counts, plus focused test and generated-config checks.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes after-patch terminal QA Lab runs for stdout-only and dual exporter modes with expected OTLP/stdout counts, plus focused test and generated-config checks.
Evidence reviewed

PR surface:

Source +100, Tests +658, Docs +14, Config 0, Generated 0, Other +206. Total +978 across 27 files.

View PR surface stats
Area Files Added Removed Net
Source 10 220 120 +100
Tests 7 676 18 +658
Docs 6 27 13 +14
Config 1 1 1 0
Generated 1 3 3 0
Other 2 206 0 +206
Total 27 1133 155 +978

What I checked:

  • Live PR state: The PR is open, not draft, mergeable clean, labeled maintainer, proof: sufficient, and merge-risk: 🚨 compatibility; the current head is d5b2148. (d5b2148cd4e6)
  • Current main lacks the feature: Current origin/main has OTEL log export but no logsExporter, stdout JSONL sink, or openclaw.diagnostic.log stdout record contract, so the PR is new functionality rather than obsolete duplication. (82ae81f3bf1d)
  • Public config contract added: The PR adds logsExporter?: "otlp" | "stdout" | "both" to the diagnostics OTEL config type and schema. (src/config/types.base.ts:306, d5b2148cd4e6)
  • Runtime sink selection: The diagnostics-otel service keeps OTLP as the default, derives OTLP/stdout sinks separately, and only blocks unsupported protocols when an OTLP signal is active. (extensions/diagnostics-otel/src/service.ts:1350, d5b2148cd4e6)
  • Shared redaction path: Stdout export writes records built by the same diagnostic log-record path used for OTLP, including bounded body handling, attribute assignment, trace normalization, and redactOtelAttributes. (extensions/diagnostics-otel/src/service.ts:1868, d5b2148cd4e6)
  • Focused service coverage: Service tests cover stdout-only startup without OTLP construction, unsupported-protocol stdout-only startup, security-event stdout export, OTLP-only behavior, and dual OTLP/stdout export. (extensions/diagnostics-otel/src/service.test.ts:1116, d5b2148cd4e6)

Likely related people:

  • vincentkoc: Current blame and recent history on extensions/diagnostics-otel/src/service.ts route the active OTEL log export path through recent diagnostics-otel maintenance. (role: recent diagnostics area contributor; confidence: high; commits: fb69db6365b2, 8124253cdff4, de656e319471; files: extensions/diagnostics-otel/src/service.ts, docs/gateway/opentelemetry.md)
  • steipete: Git history attributes the original diagnostics events/OTEL exporter and OTLP log wiring, plus substantial QA Lab scenario infrastructure, to this person. (role: original diagnostics and QA Lab feature contributor; confidence: high; commits: 5c4079f66cc0, 6734f2d71cb1, 508024ae3b2a; files: extensions/diagnostics-otel/src/service.ts, test/e2e/qa-lab/runtime/qa-otel-smoke-runtime.ts, extensions/qa-lab/src/suite.ts)
  • SidQin-cyber: History shows prior work switching diagnostics-otel to protobuf OTLP exporters, adjacent to this PR's OTLP/stdout log sink selection. (role: adjacent exporter contributor; confidence: medium; commits: 9d3bd5099008; files: extensions/diagnostics-otel/src/service.ts)
  • gumadeiras: History shows diagnostics-otel plugin SDK boundary migration and QA Lab provider registry work near the affected plugin and QA surfaces. (role: plugin boundary and QA contributor; confidence: medium; commits: 54d78bb423d9, 56d98a50cfff, bb7e9823a886; files: extensions/diagnostics-otel/src/service.ts, extensions/qa-lab/src/suite.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Jun 18, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. labels Jun 18, 2026
@jesse-merhi jesse-merhi force-pushed the jesse-merhi/want-read-implement-tmp branch from 7c29abf to 0455847 Compare June 19, 2026 03:04
@blacksmith-sh

This comment has been minimized.

@jesse-merhi jesse-merhi force-pushed the jesse-merhi/want-read-implement-tmp branch 2 times, most recently from 5442761 to 3044e8b Compare June 19, 2026 03:27
@jesse-merhi jesse-merhi requested a review from a team as a code owner June 19, 2026 03:51
@openclaw-barnacle openclaw-barnacle Bot added the channel: voice-call Channel integration: voice-call label Jun 19, 2026
@jesse-merhi jesse-merhi force-pushed the jesse-merhi/want-read-implement-tmp branch from 4eca40d to dd9e3f8 Compare June 19, 2026 05:31
@openclaw-barnacle openclaw-barnacle Bot removed channel: discord Channel integration: discord channel: googlechat Channel integration: googlechat channel: line Channel integration: line channel: mattermost Channel integration: mattermost channel: signal Channel integration: signal channel: slack Channel integration: slack channel: voice-call Channel integration: voice-call channel: whatsapp-web Channel integration: whatsapp-web app: android App: android app: web-ui App: web-ui scripts Repository scripts commands Command implementations agents Agent runtime and tooling channel: irc extensions: openai extensions: byteplus extensions: kimi-coding labels Jun 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: ios App: ios channel: feishu Channel integration: feishu cli CLI command changes docs Improvements or additions to documentation extensions: codex extensions: copilot extensions: diagnostics-otel Extension: diagnostics-otel extensions: qa-lab gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. scripts Repository scripts size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant