Add setup-span helpers for product setup - #246
Draft
jat255 wants to merge 1 commit into
Draft
Conversation
jat255
marked this pull request as draft
September 2, 2026 00:18
`commons_span()` opens a span that is current for the duration of a `with` block, so spans opened inside it become its children. Attributes known up front are passed at creation, because samplers see only those and Connect snapshots a span's attributes when it opens; the yielded span takes values the covered work produces. Setup spans cover building a data source or constructing an agent rather than conversation content, so they are not gated behind an agent's `log` argument and open on every agent. That is affordable because the OpenTelemetry API is inert until an SDK provider is configured, which a test pins by running a fresh interpreter and asserting the span does not record. The API is imported unguarded, so commons now requires `opentelemetry-api` outright rather than receiving it through chatlas, which is free to drop it in any release the version floor allows. Only the SDK and the exporters stay optional in the `tracing` extra. A packaging test pins both halves of that. The tracer is resolved once at import. With no provider configured that is a proxy which re-checks the global provider each time a span opens, so a provider installed later still takes effect. Part of kata bvcv (M7). Closes kata wbx8.
jat255
force-pushed
the
jat255/wbx8-span-helpers
branch
from
September 2, 2026 00:32
e0281e4 to
f5550d4
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.
First piece of M7 tracing (kata
bvcv), and the one everything else in the milestone builds on. Nothing calls it yet: the span names commons actually records arrive with the modules that record them, and the exporter that turns spans into files is the next task.commons_span()opens a span that stays current for awithblock, so spans opened inside it become its children. Attributes known up front go in at creation, because samplers see only those and Connect snapshots a span's attributes when it opens. Values the covered work produces, a row count for instance, go on the yielded span.pkg-r/R/tracing.Rhas the counterparts,local_commons_span()andcommons_span_set_attribute(); Python folds the second into the span object because a context manager already gives it back.These spans cover product setup rather than conversation content, so they are not gated behind an agent's
logargument and open on every agent. That is affordable because the OpenTelemetry API is inert until an SDK provider is configured. A test pins it by running a fresh interpreter and asserting the span does not record.The API import is unguarded, so
opentelemetry-apibecomes a plain dependency. It arrived through chatlas before, which is not something to rest on: the version floor permits a chatlas release that drops it. Only the SDK and the exporters stay in thetracingextra, and a packaging test pins both halves.The tracing tests skip when the SDK is absent. CI installs every extra, so they run there.