Azure / Azure/azure-sdk-for-python
Tracing: allow setting schemaUrl when creating OTel tracer
- Lingua principale
- Python
- Stelle
- 5.6k
- Fork
- 3.4k
- Merge medio
- 2g 2h
- PR unite (30g)
- 202
Descrizione
OTel allows setting SchemaURL (something that looks like https://opentelemetry.io/schemas/1.40.0) when creating a tracer - e.g. like in [this](https://github.com/open-telemetry/opentelemetry-python-contrib/blob/52871b82b6afc3545609d3740620a6c4d4edf7ab/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/__init__.py#L75) example.
This information is exported along with the telemetry and
1. allows users to understand the format and version of traces library emits
2. allows a backend like Azure Monitor to interpret telemetry depending on this schema version
Essentially it's a versioning mechanism similar to API version.
We need to support it to allow:
- Azure AI Inference/Agents to proceed with their telemetry story and support users minimizing breaking changes on telemetry
- ServiceBus/EventHubs/CosmosDB and other SDKs that emit traces to express their own version of telemetry
This needs a similar approach as #34810 and #9256.
Here's how Java does it (full details in https://github.com/Azure/azure-sdk-for-java/pull/41789)
```java
LibraryTelemetryOptions libraryOptions = new LibraryTelemetryOptions("azure-storage-blobs")
.setLibraryVersion("12.20.0")
.setResourceProviderNamespace("Microsoft.Storage")
.setSchemaUrl("https://opentelemetry.io/schemas/1.23.1");
Tracer tracer = TracerProvider.getDefaultProvider()
.createTracer(libraryOptions, clientOptions.getTracingOptions());
```
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.