Skip to content

Add otel.scope.schema_url to non-OTLP exporters #2489

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

pellared
Copy link
Member

@pellared pellared commented Jul 7, 2025

Fixes #2320

Related to (follows):

The Instrumentation Scope Attributes for non-OTLP formats already says what exporters can do with scope attributes.

Changes

Add otel.scope.schema_url attribute to non-OTLP exporters that represents an instrumentation scope schema URL.

Remarks

Schema URL is defined as part of instrumentation scope in the spec: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/common/instrumentation-scope.md

However, in OTLP it is always on a "higher" level for reasons unknown to me (maybe it was historically introduced before the concept of the instrumentation scope?): https://github.com/open-telemetry/opentelemetry-proto/blob/c30610041736aa5c0077b156f27b09e878b797ea/opentelemetry/proto/trace/v1/trace.proto#L58-L64

We could consider also naming it otel.schema_url. However, with the pre-work of https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/common/instrumentation-scope.md and open-telemetry/opentelemetry-specification#4505 I prefer otel.scope.schema_url.

@pellared

This comment was marked as outdated.

@ArthurSens

This comment was marked as outdated.

thompson-tomo

This comment was marked as outdated.

@pellared

This comment was marked as outdated.

@pellared
Copy link
Member Author

pellared commented Jul 7, 2025

Undrafting as this needs to be reviewed/discussed even though it is not ready to be merged.

@pellared pellared marked this pull request as ready for review July 7, 2025 15:55
@pellared pellared requested review from a team as code owners July 7, 2025 15:55
@pellared pellared self-assigned this Jul 7, 2025
@pellared pellared added this to Logs SIG Jul 7, 2025
@pellared pellared moved this to In progress in Logs SIG Jul 7, 2025
@ArthurSens

This comment was marked as outdated.

@aknuds1

This comment was marked as outdated.

@pellared

This comment was marked as outdated.

@aknuds1

This comment was marked as outdated.

@ArthurSens

This comment was marked as outdated.

@dashpole

This comment was marked as outdated.

@lmolkova

This comment was marked as outdated.

@dashpole

This comment was marked as outdated.

@lmolkova

This comment was marked as outdated.

@joaopgrassi
Copy link
Member

This I don't agree with - the source of the data is OTel and OTel recommends namespacing everything - main/docs/general/naming.md#recommendations-for-application-developers.

So good otel instrumentation should not put name on scope and name on data, it would put something like foo.name on the scope attribute and bar.name on the telemetry item.

If they put the same name on both, they want to pass the same thing twice - this seems redundant and ambigous. And while it's allowed, it makes no sense.

I also agree here with @lmolkova. If the deal is because of prometheus compatibility, we already have that defined in the other document: https://github.com/open-telemetry/opentelemetry-specification/blob/ac137b349b006dc926da91c6a6619217737921cc/specification/compatibility/prometheus_and_openmetrics.md#instrumentation-scope. So I'm not sure this needs to be defined in semconv.

@pellared pellared changed the title add more otel.scope attrs to non-OTLP exporters Add otel.scope attrs to non-OTLP exporters Jul 8, 2025
@pellared pellared requested a review from a team as a code owner July 8, 2025 13:28
@github-actions github-actions bot added enhancement New feature or request area:otel labels Jul 8, 2025
@pellared pellared changed the title Add otel.scope attrs to non-OTLP exporters Add otel.scope.<key> to non-OTLP exporters Jul 8, 2025
@pellared
Copy link
Member Author

pellared commented Jul 8, 2025

I think this PR is ready for an actual review.

CC @open-telemetry/prometheus-interoperability

Copy link
Contributor

@thompson-tomo thompson-tomo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still discussing the attributes topic but found another small thing.

@github-project-automation github-project-automation bot moved this from Untriaged to Blocked in Semantic Conventions Triage Jul 8, 2025
@pellared pellared requested a review from thompson-tomo July 8, 2025 14:16
@ArthurSens
Copy link
Member

We managed to revert the feature in Prometheus before it made it into a release: prometheus/prometheus#16842

It should be safe to change the spec

@pellared
Copy link
Member Author

pellared commented Jul 8, 2025

It should be safe to change the spec

Can you please how do we want to change the spec?
What do you changes do you have in mind, the ones from this PR or some follow-up in Spec repo?

@pellared
Copy link
Member Author

pellared commented Jul 8, 2025

OTel Logs SIG meeting notes (from my memory):

For most use-cases non-OTLP exporters could simply put scope attributes to attributes/tags without any modifications.

However, for places where OTel's nested structure (resource, scope, datapoint) when translating is important adding an otel.scope. prefix can be allowed (it would be especially handy for Collector receivers). Probably this should be an opt-in behavior for the non-OTLP exporters.

It looks like we do not need to describe anything in the Semantic Conventions.

@lmolkova, @trask, @austinlparker, feel free to edit my comment if I missed anything or made any mistake.

@pellared
Copy link
Member Author

pellared commented Jul 8, 2025

Maybe the existing description in Instrumentation Scope Attributes for non-OTLP formats is good enough?

I changed this PR so it only adds otel.scope.schema_url which is not controversial and I also plan create a similar PR for (https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/common/mapping-to-non-otlp.md#instrumentation-scope-attributes.

@pellared pellared changed the title Add otel.scope.<key> to non-OTLP exporters Add otel.scope.schema_url to non-OTLP exporters Jul 8, 2025
type: string
brief: The schema URL of the instrumentation scope.
examples: ['https://opentelemetry.io/schemas/1.31.0']
stability: stable
Copy link
Member Author

@pellared pellared Jul 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want/need to make it "development" first?

@ArthurSens
Copy link
Member

ArthurSens commented Jul 8, 2025

It should be safe to change the spec

Can you please how do we want to change the spec? What do you changes do you have in mind, the ones from this PR or some follow-up in Spec repo?

What I meant here is that we were able to revert our commitment to translating Scope attributes to otel_scope_[attr] before it gets released in Prometheus. This means we can adjust the spec, e.g., using otel_scope_attr_[attr] instead if we so desire and that won't be a breaking change in Prometheus. And by spec, I mean the Prometheus and OpenMetrics compatibility.

@pellared
Copy link
Member Author

pellared commented Jul 9, 2025

What I meant here is that we were able to revert our commitment to translating Scope attributes to otel_scope_[attr] before it gets released in Prometheus. This means we can adjust the spec, e.g., using otel_scope_attr_[attr] instead if we so desire and that won't be a breaking change in Prometheus. And by spec, I mean the Prometheus and OpenMetrics compatibility.

@ArthurSens, with the conversation we had I think it is find to keep otel_scope_[attr]. There is a question whether users would not simply prefer [attr] instead. This could be potentially configurable. In my opinion this can be discussed separately by @open-telemetry/prometheus-interoperability. I am sorry for my bothersome way of working...

@ArthurSens
Copy link
Member

@ArthurSens, with the conversation we had I think it is find to keep otel_scope_[attr]. There is a question whether users would not simply prefer [attr] instead. This could be potentially configurable. In my opinion this can be discussed separately by @open-telemetry/prometheus-interoperability. I am sorry for my bothersome way of working...

No problems at all! I'm glad we have the chance to align, please don't hesitate to keep tagging us when things aren't clear

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:otel enhancement New feature or request
Projects
Status: In progress
Development

Successfully merging this pull request may close these issues.

Document otel.scope.schema_url used by non-OTLP exporters
7 participants