Azure / Azure/azure-sdk-for-python

Tracing: allow setting schemaUrl when creating OTel tracer

Abierto
#39,181 1 comentario 0 reacciones 1 asignado Reclamado por @pvaneck Ver en GitHub
Azure.Core Client OpenTelemetry
Lenguaje dominante
Python
Estrellas
5.6k
Forks
3.4k
Merge medio
2 d
PR fusionados (30 d)
217

Descripción

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

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.