Repository navigation
Collector: keep Claude tool_use_id and cost_usd through Loki, drop Codex tool arguments, whole-run query guidance - #408
Merged
Conversation
Retain tool_use_id and cost_usd alongside the existing workflow.run_id, session.id and ecosystem.task.id resource route. Keep the current structured metadata policy and metric writer identity. Add red-before-green unittest coverage through native Collector 0.161.0 and Loki 3.7.8, including per-arm usage, resource-only runs, private tool joins and indexed-series checks. Sources: Anthropic monitoring documentation, checked 2026-09-27: https://code.claude.com/docs/en/monitoring-usage anthropics/claude-code v2.1.283 release notes and installed client. open-telemetry/opentelemetry-collector-contrib v0.161.0: processor/transformprocessor/README.md and pkg/ottl/ottlfuncs/func_keep_keys.go. grafana/loki v3.7.8 with https://grafana.com/docs/loki/latest/send-data/otel/ and https://grafana.com/docs/loki/latest/reference/loki-http-api/. open-telemetry/opentelemetry-proto v1.9.0, docs/specification.md. Validation: 81 covering unittest checks passed without skips; the complete Collector profile passed native validation after creating documented scratch directories. Local integration uses synthetic inputs, not a new model run. Content written by GPT-6 (gpt-6-astra, effort max) through the Codex worker lane and the OmniRoute pool; committed by the coordinator harness. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Correct the Claude custom-attribute citation and resource/event/datapoint description, whole-run prefix queries, deployment path and dated E2E gates. Publish original and repair command/result excerpts directly in the PR body. Explicitly delete Codex arguments with native OTTL and preserve tool namespace, guarded MCP server, timing, success, correlation and supplied size metadata. Test duplicate Claude run attributes and Codex records with and without server metadata through installed Collector 0.161.0 and Loki 3.7.8. Sources: open-telemetry/opentelemetry-collector-contrib v0.161.0, processor/transformprocessor/README.md and pkg/ottl/ottlfuncs/README.md; openai/codex rust-v0.157.1, codex-rs/otel/src/tool_result.rs:55-79,94, codex-rs/otel/src/events/shared.rs:59-60 and codex-rs/core/src/tools/call_trace.rs:38-54; https://code.claude.com/docs/en/monitoring-usage#multi-team-organization-support; https://grafana.com/docs/loki/latest/query/log_queries/ and send-data/otel/; open-telemetry/opentelemetry-proto v1.9.0 docs/specification.md; base ec27a30, #364 c71d66d and #366 a464d28 historical receipts. Verification: failing-first C1 checks, then 83 covering unittests pass with no skips; complete native Collector validate and git diff --check pass. Evidence is local integration with synthetic fixtures, not live-provider/host acceptance. The coordinator owns receipt hash registration and commit creation. Content written by GPT-6 (gpt-6-astra, effort max) through the Codex worker lane and the OmniRoute pool; committed by the coordinator harness. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…drop an unsupported #366 citation Coordinator correction after the independent repair verification: the repair's receipt edits were withdrawn (RUNBOOK.md is hash-sealed; the E2E README changes only by amendment), so the README must not say they carry dated updates; the #366 receipt does not record a byte-identical host deployment. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
seathatflowsinourveins
force-pushed
the
claude/w3-collector-20260927
branch
from
September 27, 2026 17:33
13029ec to
14feac4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Claude tool events lost
tool_use_idand API requests lostcost_usdin theCollector privacy allowlist. Preserve both fields so the existing run/session
identities can support transcript joins and per-arm usage reconciliation in
Loki. The repair also makes Codex argument removal explicit in the privacy
transform while retaining measurement metadata, and corrects the deployment,
query and historical gate documentation. These fields remain structured
metadata; only
service.nameis indexed.Changes
observability/collector/collector.yaml: retaintool_use_idandcost_usd;explicitly delete Codex
argumentswith native OTTL; retainoutput_truncatedand suppliedarguments_length,output_lengthandoutput_line_count. Preserve tool/namespace, guarded MCP-server names,duration, success and existing run/session fields. Fix the Claude source anchor.
tests/test_observability_run_correlation.py: exercise actual nativeCollector-to-Loki ingestion, two Workflow arms, matching resource/event run
attributes, whole-run prefix/single-arm queries, session/tool joins,
string/numeric/zero costs, absent values and indexed-series cardinality.
Add Codex content-removal and metadata-retention fixtures, including a
context-mode call without MCP-server metadata and optional size counters.
Two configuration regressions run without optional dependencies; native
tests require the documented pins and PyYAML.
observability/collector/README.md: correct Claude custom-attribute emission,whole-run filters, historical bases and the host installation path. Explain
the Codex output-preview/content boundary and the trace-only size fields.
manifests/evidence.json: the coordinator re-registers this branch's threechanged files in the last commit (docs/lanes.md hot-file protocol).
Evidence
on 2026-09-27; installed Codex 0.157.1, Claude Code 2.1.283, Collector 0.161.0
and Loki 3.7.8 (revision
09e6ce2f) checked. Matching release notes were readthrough
gh api. These are capability/version checks, not model runs.Loki on isolated loopback ports; independently queried Loki and inspected the
file exporter. Both copies of Claude's run key survive and native whole-run
queries include suffixed arms while excluding an adjacent run. Codex arguments
and output are absent; tool/namespace, optional guarded server, timing,
success, correlation and supplied sizes survive without new index labels.
using
/usr/bin/python3with installed PyYAML 6.0.1. No dependencies installed.Collector
validatecommand with its queue/receipt-directory prerequisites.none performed. The fixture checks do not establish these evidence classes.
Original build, historical returned excerpts (2026-09-27): failing first
against the original configuration, then the same module after retaining the
Claude fields. These excerpts preserve the earlier result, rather than claiming
a new execution of that earlier configuration:
The original complete-profile check first failed on its missing queue directory;
after creating the queue and SDK receipt directories from the install recipe,
the same native command passed. Returned excerpts, with the workspace sanitized:
Repair, returned excerpts (2026-09-27):
TMPDIRwas explicitly exported forall repair unittests. Native shell creation of that directory was refused by the
execution sandbox; the context-mode test runner created it successfully. An
initial fixture draft assumed a third metadata element in default Loki query
rows and errored in three subtests. Corrected it to inspect the file exporter
and use Loki metadata filters. Before changing the configuration, the corrected
C1 tests then failed on four absent size/truncation keys and three missing
output_truncatedvalues. Argument removal already passed on this branch;these failures are metadata retention failures, not proof of a repository leak.
SOTA sources
checked 2026-09-27, and anthropics/claude-code v2.1.283.
workflow.run_idis documented on Workflow-agent API/tool events, includingdescendants, since 2.1.202. Non-Workflow events rely on the caller-supplied
ecosystem.task.idcustom key for this run contract, copied to resources,events and datapoints per Multi-team organization support.
openai/codexrust-v0.157.1:tool_result.rs:55-79and preview truncation at line 94,
events/shared.rs:59-60and
call_trace.rs:38-54.open-telemetry/opentelemetry-collector-contribv0.161.0:Transform Processor
and
keep_keysimplementation,plus the existing native
delete_keyoperation.grafana/lokiv3.7.8, installed revision09e6ce2f:release,
native OTLP ingestion
and query/series HTTP APIs,
with regex label filters.
open-telemetry/opentelemetry-protov1.9.0:OTLP specification.
Test lifecycle and transport reuse the repository's
tests/test_observability_tool_names.pypattern and committed backend template.ec27a300; Telemetry writer identity (G1): one writer per token series, integrity alerts and a committed host recipe #364c71d66d0; Tool invoke rates: tool, MCP server, skill and subagent names in Loki and Grafana (stacked on #364) #366a464d288.The writer-identity
host/merge_collector.py:116-118explains why thecurrent logs change needs reviewed-profile installation instead of apply.sh.
Review dispositions
Five reviewer findings are repaired. The receipt part of finding 4 is disputed with source:
#multi-team-organization-support.exercise both log copies against native Loki instead of a resource-only fixture.
ec27a300, Telemetry writer identity (G1): one writer per token series, integrity alerts and a committed host recipe #364 and Tool invoke rates: tool, MCP server, skill and subagent names in Loki and Grafana (stacked on #364) #366. The receipt edits arewithdrawn and disputed with source. RUNBOOK.md is hash-sealed: the E2E README seal list, checked by
tests/test_token_e2e_preregistration.test_sealing_hashes_and_amendment_rule. The E2E README changes
only through its append-only amendment rule. Their correction goes to a dated PR-H: E2E preregistration for the token-save-practice stack (frozen tasks, metrics, gate, procedure) #381 amendment.
install, native validate and user-service restart path.
C1: implemented explicit argument deletion and safe metadata retention.
The original Codex source calls the server field
mcp_server; the existingguarded
mcp_server.namemapping supplies Loki'smcp_server_name. Namespaceretention covers absent-server calls. At the pinned source, size counters are
in the trace branch, while
output_truncatedis common to logs/traces. Thefixture tests supplied counters without claiming a new native-log capability.
The peer's live-host leak is a deployment finding; this branch already excluded
arguments via its content deletion and allowlist. No host deployment was made.
Residuals and not done
made. The token-adoption E2E still needs actual tagged-run delivery/flush and
transcript reconciliation. A merge or synthetic pass is not that acceptance.
cost_usdremains an estimate; it does not establish billing or replace thefrozen dated-price method. Missing cost or identity stays absent.
or a separately retained session mapping. The shared run key alone cannot
assign arms. Existing Workflow ID validation still bounds accepted values.
env/call_idresiduals, new correlation fields, dashboards and metricsremain outside this repair. Codex arguments and safe tool metadata are included
under C1. Missing size counters stay absent; traces remain disabled.
cost_usdtype has not been confirmed through live provider execution;the fixtures cover both string and numeric values, including zero.
:429-435, README.md:542), and the RUNBOOK's whole-run query at :457 uses exact equality. Their correction
waits for PR-H: E2E preregistration for the token-save-practice stack (frozen tasks, metrics, gate, procedure) #381's dated amendment. Until then, this collector README section supersedes their field-gap
statements.
Recommended lane label: lane:foundation.
Coordinator note on this repair round
The repair round also edited two #381 receipts,
evidence/artifacts/token-adoption-e2e-20260926/RUNBOOK.mdand itsREADME.md. The coordinator withdrew both edits: RUNBOOK.md is hash-sealed (tests.test_token_e2e_preregistration.test_sealing_hashes_and_amendment_rulefailed on the change), and the E2E README changes only through its append-only amendment rule. #381's owner carries these facts in its pre-freeze readiness amendment:tool_use_idandcost_usdare kept in transform/privacy keep_keys;workflow.run_idhas been kept since Tool invoke rates: tool, MCP server, skill and subagent names in Loki and Grafana (stacked on #364) #366 (a464d28);argumentsis dropped;ecosystem_task_id=~"<run>(\\..+)?";After the repair round the coordinator also corrected two collector README statements that the independent repair verification found unsupported. One claimed the sealed receipts "now carry a dated update". The other cited #366's deployment as byte-identical, which its receipt does not show.
Acceptance after the repair (local integration, this host):
validate.shFAILS=0. The full suite ran 6598 tests. It had two known environment failures:test_pre_commit_gate, which fails on the unchanged base, andtest_host_profile_copy_is_verbatim, which fails on old-base branches since this host installed #402's guard.🤖 Generated with Claude Code