Azure / Azure/azure-sdk-for-python

Tracing: allow setting schemaUrl when creating OTel tracer

Offen
#39,181 1 Kommentar 0 Reaktionen 1 zugewiesene Person Beansprucht von @pvaneck Auf GitHub ansehen
Azure.Core Client OpenTelemetry
Vorherrschende Sprache
Python
Sterne
5.6k
Forks
3.4k
Ø Merge
2 T. 2 Std.
Gemergte PRs (30 T.)
202

Beschreibung

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());
```

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.