openai / openai-dotnet

The official .NET library for the OpenAI API
https://www.nuget.org/packages/OpenAI/AbsoluteLatest
MIT License
734 stars 64 forks source link

Add instrumentation for simple convenience chat calls #107

Open lmolkova opened 2 days ago

lmolkova commented 2 days ago

This PR builds foundation for OpenAI SDK tracing and metrics instrumentation (using Otel-compatible .NET primitives).

It's limited to convenience ChatClient methods without streaming. The PR implements instrumentation according to OpenTelemetry GenAI semantic conventions.

The intention is to add instrumentation to other methods and client types and evolve it along with OTel GenAI semantic conventions.

TODO (in this PR):

TODO (in next PRs):