Repository navigation
fix(tracing): the answer of a function that answers for itself carries its execution, and a caller's record holds its annotations - #98
Merged
Conversation
…s its execution, and a caller's record holds its annotations An interceptor answers through its reply address, and the caller writes the trace record of a request-response call from that answer. An answer that a handler built and sent with registry.send_event() carried nothing of the execution: the record held no exec_time, no span_id and no annotations, and a function that received the answer through a reply route ran untraced. - bus.py keeps an interceptor's execution in a context variable, and stamp_answer gives an unmarked envelope sent from inside it to the request's reply address the execution's span, annotations and elapsed time, and the sender and the trace where it has none. registry.send_event calls it, so the error envelope of an uncaught exception is covered too. - An envelope to another route is not touched, a stream's segments stay the stream writer's, and a relayed answer keeps its writer's time and sender. - server.py writes the function's round-trip record for a wire request-response call to an interceptor, also when it times out, as it does for a function that returns its answer. - EventBus.emit writes a caller's annotations under "annotations": the key was "notes" since the record was introduced in 4.12.30, where every other record and the forwarder's span mapping use "annotations". tests/test_interceptor_answer.py holds it with functions that work for 300 ms: eight of its nine tests failed against the pack as it was. The streaming guide and the tracing section of the configuration guide say what the answer carries, and the CHANGELOG has two entries under Fixed. The twin of the engines' fix for their HTTP client (mercury-composable #715 and #716) and of the Node.js pack's fix. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
acn-ericlaw
added a commit
that referenced
this pull request
Dec 5, 2026
… answer's annotations by the Java rule (#99), both merged Two session logs. 2026-12-05-011101: an interceptor's answer carries its execution, the host writes the function's record for a wire request-response call to an interceptor, and a caller's record holds its annotations under "annotations". 2026-12-05-013448: the worker and the stamp set an answer's annotations from the execution, as the Java engine's worker does; a finding about that engine corrected by a probe and pinned by a test. Continuity: trace-records-engine-parity gains both and is active again; the fact footers are refreshed from the reference logs. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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.
What
The answer of a function that answers for itself carries its execution, and a caller's trace record holds its annotations under
annotations. The twin of the Node.js pack's fix, Accenture/mercury-nodejs#158.stamp_answerinbus.pydoes it, called byregistry.send_event, the one place every reply passes; the error envelope of an uncaught exception is covered by the same call.exec_timeand sender of an answer passed on from another function./api/eventfor an interceptor, the host writes the function's round-trip record, also when the call times out, as it does for a function that returns its answer.EventBus.emitwrites a caller's annotations underannotations.registry.send_event()and says what the answer carries; the tracing section of the configuration guide gains the rule; two entries under Fixed in the CHANGELOG.Why
The engines' HTTP client answers for itself, and its record of a request-response call held no annotation, no span and no execution time; that was fixed in mercury-composable #715 and #716. The maintainer asked whether the flaw applies to the packs, and then for the fix. Execution time matters here because the DevSecOps team relies on it for performance reporting.
The packs have no HTTP client function; the flaw was general. The caller writes the record of a request-response call from the first reply, and a reply that a handler built and sent itself carried nothing of its execution. Measured with a function that works for 300 ms, before this change:
exec_time, nospan_id, no annotations/api/eventFound at the build: a caller's record has held the responder's annotations under the key
notessince the record was introduced in 4.12.30. A quality round renamed a parameter that shadowedannotationsand the key with it. Every other record, the Node.js pack and the engines writeannotations, and the OpenTelemetry forwarder's span mapping reads that key, so those annotations were on the log line under another name and on no exported span.Upgrade notes
exec_time,span_idand its annotations.notesof adistributed.tracingrecord readsannotations.Decisions that are mine
notesfix rides in this commit, because the record it repairs is the one the new tests read. It can be split into a pull request of its own.rpctag, so any other call keeps the one record its execution writes. A test holds that.Seen beside it, not changed
tofield on the wire, where a stream's envelopes are cleared of it.How it was checked
tests/test_interceptor_answer.py, nine tests: eight failed against the pack as it was; the ninth guards a call without therpctag against a second record and passed before and after.pytest: 3,025 passed, 76 skipped.ruff check .: clean.basedpyright: 0 errors.mkdocs build --strictpasses; the CHANGELOG's released sections equal the newest tag's text.Co-Authored-By: Claude Fable 5.2 noreply@anthropic.com
🤖 Generated with Claude Code