Skip to content
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

OTLP proto encoding methods are missing instrumentation scope schema url and attributes #4358

Open
dbarker opened this issue Dec 16, 2024 · 3 comments · May be fixed by #4359
Open

OTLP proto encoding methods are missing instrumentation scope schema url and attributes #4358

dbarker opened this issue Dec 16, 2024 · 3 comments · May be fixed by #4359
Labels
bug Something isn't working

Comments

@dbarker
Copy link

dbarker commented Dec 16, 2024

Describe your environment

Python version: Python 3.9.21
SDK version: 1.30.0.dev
API version: 1.30.0.dev

What happened?

Spans, metrics, and logs with instrumentation scope attributes and a schema url set are missing this data when exporting to otlp proto messages. Encoding the instrumentation scope schema url and attributes are missing from opentelemetry-exporter-otlp-proto-common

Steps to Reproduce

  1. Add a schema url and attributes when getting a meter, tracer, or logger.
  2. Create and record a span, metric, or log record
  3. Export to an otel-collector with the otlp grpc receiver and debug exporter configured

Expected Result

The instrumentation scope schema url and attributes should show up in the otel-collector debug output

Actual Result

The instrumentation scope schema url and attributes are missing

Additional context

The _encode_instrumentation_scope method is not encoding the attributes

Logs encoder is not setting the ScopeLogs.schema_url

Metrics encoder is not using the _encode_instrumentation_scope method and is not setting the ScopeMetrics.schema_url

Trace encoder doesn't set the ScopeSpans.schema_url

Would you like to implement a fix?

Yes

@dbarker dbarker added the bug Something isn't working label Dec 16, 2024
@dimaqq
Copy link
Contributor

dimaqq commented Feb 18, 2025

Sorry for the drive-by question, but why?
More specifically, the SDK appears to have worked for years without the schema urls.

I agree that missing schemata is a nit in the implementation, however there's some overhead, which begs to question what the benefit is.

@dbarker
Copy link
Author

dbarker commented Feb 19, 2025

Sorry for the drive-by question, but why? More specifically, the SDK appears to have worked for years without the schema urls.

I agree that missing schemata is a nit in the implementation, however there's some overhead, which begs to question what the benefit is.

Hey @dimaqq, Its a good question. The spec covers the why pretty well.

TLDR:

Our goal is narrowly defined to solve the following problem only: to allow OpenTelemetry Semantic Conventions to evolve over time.

Scope level schema URLs have been in this sdk for a while and this issue just addresses not encoding the urls (and attributes - which my project needs) to OTLP protobuf messages on export. They are still optional but encoding them is a requirement of the spec. #4359 just assigns the scope schema url and attributes to the protobuf object on export. The performance impact will be negligible considering these are still optional, default to None, and encoding to otlp is an export time operation (typically called every ~30-60s if using a batch processor).

@dimaqq
Copy link
Contributor

dimaqq commented Feb 20, 2025

Oh I see that schemata are relatively new: open-telemetry/oteps#152

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants