-
Notifications
You must be signed in to change notification settings - Fork 647
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add metrics to the Python OpenAI instrumentation #3180
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of nits but LGTM. Not sure that setting the views for having proper buckets it's useful but no big deal.
instrumentation-genai/opentelemetry-instrumentation-openai-v2/CHANGELOG.md
Outdated
Show resolved
Hide resolved
...opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py
Outdated
Show resolved
Hide resolved
instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/conftest.py
Show resolved
Hide resolved
instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/buckets/README.rst
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, just a few comments on recording errors
...pentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/meters.py
Outdated
Show resolved
Hide resolved
...opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py
Outdated
Show resolved
Hide resolved
...opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py
Show resolved
Hide resolved
...opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py
Show resolved
Hide resolved
...mentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_async_chat_completions.py
Outdated
Show resolved
Hide resolved
instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/conftest.py
Show resolved
Hide resolved
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
Description
This PR implements the GenAI semantic conventions for the two client metrics so they are collected along with spans when instrumenting a Python application.
Basic implementation of two client metrics defined in the GenAI semantic conventions:
gen_ai.client.token.usage
- Documentationgen_ai.client.operation.duration
- DocumentationThere is an example added to show end users who to configure the explicit bucket boundaries as defined in the semantic convention spec.
Fixes #3177
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Does This PR Require a Core Repo Change?
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.