Repository navigation
fix(tracing): the answer of a function that answers for itself carries its execution - #158
Merged
Merged
Conversation
…s its execution 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.sendEvent() 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.ts keeps an interceptor's execution in an AsyncLocalStorage, and stampAnswer 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.sendEvent calls it; the error envelope of an uncaught exception is stamped with the execution handed over, since the handler's context has ended by then. - 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.ts 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. test/interceptor-answer.test.ts holds it with functions that work for 300 ms: seven 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 the entry under Fixed. The twin of the engines' fix for their HTTP client (mercury-composable #715 and #716) and of the Python 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
…n answer's annotations by the Java rule (#159), both merged Two session logs. 2026-12-05-011126: an interceptor's answer carries its execution, and the host writes the function's record for a wire request-response call to an interceptor. 2026-12-05-013504: 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. The twin of the Python pack's fix, Accenture/mercury-python#98.
stampAnswerinbus.tsdoes it, called byregistry.sendEvent, the one place every reply passes. The error envelope of an uncaught exception is built after the handler's context has ended, so it is stamped with the execution handed over.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.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/eventUpgrade notes
exec_time,span_idand its annotations.Decisions that are mine
rpctag, so any other call keeps the one record its execution writes. A test holds that.bus.ts.event-stream.tsimports the bus and the registry, so importingstreamSignalinto the bus would close an import cycle.Seen beside it, not changed
tofield on the wire, where a stream's envelopes are cleared of it.How it was checked
test/interceptor-answer.test.ts, nine tests: seven failed against the pack as it was; the reference test of a function that returns its answer and the guard of a call without therpctag passed before and after.npm test: 2,945 tests, 2,869 passed, 76 skipped, none failed.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