Azure / Azure/azure-sdk-for-python

Tracing: allow setting schemaUrl when creating OTel tracer

Ouverte
#39,181 1 commentaire 0 réactions 1 personne assignée Voir sur GitHub

@pvaneck y travaille déjà.

Depuis le 14/1/2025.

Azure.Core Client OpenTelemetry
Langage dominant
Python
Étoiles
5.6k
Forks
3.4k
Merge moyen
2 j 2 h
PR mergées (30 j)
213

Description

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

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.