open-telemetry / opentelemetry-python

OpenTelemetry Python API and SDK
https://opentelemetry.io
Apache License 2.0
1.67k stars 570 forks source link

Add GenAI Semantic Convention #3868

Closed gyliu513 closed 1 week ago

gyliu513 commented 2 months ago

Before opening a feature request against this repo, consider whether the feature should/could be implemented in the other OpenTelemetry client libraries. If so, please open an issue on opentelemetry-specification first.

Is your feature request related to a problem? Gen AI Semantic Convetion has been merged at https://github.com/open-telemetry/semantic-conventions/pull/825 , the semantic convetion sdk needs to be updated to enable Gen AI.

@lmolkova @nirga comments? Thanks

Describe the solution you'd like What do you want to happen instead? What is the expected behavior?

Describe alternatives you've considered Which alternative solutions or features have you considered?

Additional context Add any other context about the feature request here.

gyliu513 commented 2 months ago

Related to https://github.com/traceloop/openllmetry/issues/880

nirga commented 2 months ago

@lmolkova this should get generated automatically, right?

gyliu513 commented 2 months ago

Good to know, @lmolkova @nirga do you know if there are any documentation that I can refer to check the how this will be generated automatically? Thanks

lmolkova commented 2 months ago

yes, once otel semconv is released, then someone can come to this repo and update semconv to the latest version.

There is a script that generates attribute names and values here - https://github.com/open-telemetry/opentelemetry-python/blob/main/scripts/semconv/generate.sh, but it's about to change quite a bit in https://github.com/open-telemetry/opentelemetry-python/pull/3586.

There are docs here https://github.com/open-telemetry/build-tools/blob/main/semantic-conventions/README.md#code-generator.

To be fair, I don't think that auto-generation of 10-20 attributes we've introduced in the GenAI semconv so far is worth a hustle - you can always define them as a constants in instrumentation libraries and once semconv are stabilized, switch over to the semantic-conventions library (or not).

nirga commented 2 months ago

In that case we can just update the ai-semconv in our repo @gyliu513