OTEP: Span type over OTLP - #5233
Conversation
|
|
||
| ### SDK | ||
|
|
||
| - Span type becomes a sampler input, next to name and `SpanKind`, so sampling |
There was a problem hiding this comment.
yes! but also #1588 😅 (this seems like the kind of detail that can be worked on post-OTEP)
There was a problem hiding this comment.
I think the real issue (which #1588 touches on) is that its hard to evolve the parameters made accessible to Sampler. I don't think we should let that get in the way.
There was a problem hiding this comment.
It makes sense for SDKs to bundle these changes together at least when stabilizing this API to minimize churn and forward compatibility pains. Added a note to consider it when working on the spec.
cijothomas
left a comment
There was a problem hiding this comment.
Looks good and I agree with the direction. Details can be specified at specification time.
(Left a non-blocking comment about "span.type" and "log.event_name" assymetry, but don't have any bette suggestions myself)
Pull request dashboard statusWaiting on the author · refreshed 2026-09-01 21:41 UTC Respond to 1 review item (e.g. link a commit, explain why not, ask a follow-up):
Status above doesn't look right?
|
|
|
||
| ### SDK | ||
|
|
||
| - Span type becomes a sampler input, next to name and `SpanKind`, so sampling |
There was a problem hiding this comment.
I think the real issue (which #1588 touches on) is that its hard to evolve the parameters made accessible to Sampler. I don't think we should let that get in the way.
This comment has been minimized.
This comment has been minimized.
MrAlias
left a comment
There was a problem hiding this comment.
I support adding a scalar span-definition identity and agree that multiple semantic facets should not turn type into a list. The proposal still needs a viable cross-language compatibility and identity model before we commit this direction across the API, SDK, and protocol.
| Values are owned by whoever defines the convention: OpenTelemetry semantic | ||
| conventions, or a third party. They SHOULD follow | ||
| `{area}.{kind}.{domain-specific-name}`, for example `messaging.producer.send`, | ||
| `gen_ai.client.inference`, `http.server.request`, so that they do not collide and | ||
| so that a prefix can be used for coarse grouping by area and kind. |
There was a problem hiding this comment.
{area}.{kind}.{domain-specific-name} only avoids collisions within one resolved registry. Since third-party registries may define the same string, the OTEP needs to say whether identity is globally namespaced or scoped by schema_url; this also determines what samplers must receive to match a definition unambiguously.
There was a problem hiding this comment.
There was a problem hiding this comment.
Scoping uniqueness to schema URL makes sense, and clarifies the registry model, but the matching model still needs to be clarified. Schema URL is optional, while the sampler and configuration proposals match only on span type. Two registries can therefore define the same type and produce indistinguishable matches. We need either globally unique type names (I'm guessing not likely), or identity and matching consistently defined as (schema_url, span_type), including behavior when the Schema URL is absent.
| ## Prototypes | ||
|
|
||
| - API/SDK prototype (creation-time parameter, readable span getter, sampler | ||
| input) plus the corresponding proto change: | ||
| - [Python](https://github.com/open-telemetry/opentelemetry-python/pull/5464) | ||
|
|
||
| - A [live check run][weaver-pr] resolving spans to definitions by type instead of | ||
| [hand-written heuristics][genai-rego]. |
There was a problem hiding this comment.
Neither linked prototype exercises the proposed top-level OTLP field: Python exports otel.span.type as an attribute, and Weaver reads that attribute. This change also spans stable API/SDK surfaces, so before approving the OTEP we need the typed-OO and structural-language API/SDK prototypes, plus actual Span.type protocol prototypes on both client and server, called for by the Specification Principles.
There was a problem hiding this comment.
What exactly the otlp prototype would show? That we can add a top-level string property into span proto and use it in exporters? I can burn some tokens on this, but I don't believe such prototype would be useful or reveal anything new. We've done it relatively recently for event name on logs #4320 and it was uneventful.
The OTEP is a design doc, not the actual change to specification - it might require prototypes in multiple languages but does not necessarily require them.
There was a problem hiding this comment.
I'm guessing the intent of the specification principles was to show compatibility and viability of the approach:
The specification is useless without the ecosystem it enables. Changes should focus on real world use cases, and real user needs. Additionally, changes should be implementable across the entire OpenTelemetry ecosystem.
This means proposals should think "end-to-end" not "add this one little thing".
Projects and proposals should provide prototypes or implementations before changes are made to the Specification.
We have a few simple rules of thumb regarding prototypes:
- API/SDK changes should be prototyped in three languages. The goal is coverage of possible API designs, not any specific language:
- One language should cover typed Object-Oriented ecosystems (Java, .NET, etc.)
- One language should cover dynamically typed ecosystems (Python, JavaScript)
- One language should cover structural ecosystems (Go, Rust)
- Protocol changes should be prototyped both on the client and the server.
- Prototypes can be unmerged Pull Requests, existing projects, etc. but must demonstrate the feature with confidence that the Specification of it will be successful.
The current Python prototype still exports an attribute rather than the proposed top-level OTLP field. Based on this, I'm not sure we can say there is a prototype that is showing this proposal in its described state.
Having a prototype would be helpful to me to see this in action, but I'm also fine resolving this if there explicit maintainer agreement to waive that guidance here. I can wait for implementations afterwards if that's the agreement.
|
|
||
| ### Other updates | ||
|
|
||
| - Declarative configuration: sampler configuration that matches on span type. |
There was a problem hiding this comment.
This adds sampler configuration that matches on span type, but the PR does not link a corresponding proposal in opentelemetry-configuration. CONTRIBUTING.md requires SDK component configuration changes to be proposed and approved there together; could we either add that proposal or remove this configuration change from scope?
There was a problem hiding this comment.
added more details on config in 13e40a5 and python prototype in open-telemetry/opentelemetry-python@937c832
I believe configuration PR is needed when implementing OTEP in the spec, but not for the OTEP itself - it does not add SDK component config just yet.
opentelemetry-specification/CONTRIBUTING.md
Lines 48 to 51 in 8057bf6
My goal here is to outline direction and show it's possible and can fit nicely into declarative config.
There was a problem hiding this comment.
The OTEP does say the rule-based sampler schema gains span_types, so it is proposing an SDK component configuration modification, right? Should we just defer this configuration change from the OTEP’s scope and add it as a follow-up task?
This comment has been minimized.
This comment has been minimized.
|
@MrAlias thanks for the review! I believe I addressed some of your comments and replied to others. Could you please take another look? Thanks! |
|
@lmolkova I think some strange GitHub issues is occurring. GitHub still shows this PR at 7f69c92, while lmolkova:span-type-otep is at 6bc3dcd. The linked fixes therefore aren’t part of the PR diff or its CI yet. Could you update or repush the PR branch so the PR head reflects the new commits? I reviewed the fork branch directly in the meantime, but don't have code here to reference in a review. |
|
Quick Go prototype looks ok to me: open-telemetry/opentelemetry-go#8914 |
oh, merged main and it fixed things. thank you @MrAlias ! |
Related to #4733, #531
open-telemetry/semantic-conventions#2055,
open-telemetry/semantic-conventions#3936
Changes
Some signals can be identified in OTLP by a dedicated field: metrics by name, events by name, and entities by type. Spans and profiles cannot.
This makes several things difficult:
This OTEP proposes adding
typeas a new optional, top-level OTLP field. Instrumentation may set it through the API, and samplers may use it when making sampling decisions.The main concerns raised previously, as I recall, were:
An attribute could serve a similar purpose, but we already explored that approach for events and ultimately introduced a top-level field. A dedicated field avoids concerns around attribute merging, modification, and removal due to limits, while improving performance and simplifying routing and filtering.
This proposal is not breaking. Instrumentation does not need to populate the field immediately, and consumers may ignore it until they have a use for it. Applications don't need to set it directly unless they want to identify spans for querying or validation.
CHANGELOG.mdfile updated for non-trivial changes[chore]in the PR title to skip the changelog check