Add Initial Support for Instrumenting OpenAI Python Library - Chat Completion Create#2759
Merged
lzchen merged 53 commits intoopen-telemetry:mainfrom Oct 22, 2024
Merged
Conversation
xrmx
reviewed
Jul 31, 2024
Contributor
xrmx
left a comment
There was a problem hiding this comment.
Added a first round of comments, thanks!
instrumentation/opentelemetry-instrumentation-openai/README.rst
Outdated
Show resolved
Hide resolved
instrumentation/opentelemetry-instrumentation-openai/pyproject.toml
Outdated
Show resolved
Hide resolved
instrumentation/opentelemetry-instrumentation-openai/pyproject.toml
Outdated
Show resolved
Hide resolved
...on/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/__init__.py
Outdated
Show resolved
Hide resolved
...telemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/span_attributes.py
Outdated
Show resolved
Hide resolved
...on/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/__init__.py
Outdated
Show resolved
Hide resolved
instrumentation/opentelemetry-instrumentation-openai/pyproject.toml
Outdated
Show resolved
Hide resolved
...ation/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/patch.py
Outdated
Show resolved
Hide resolved
...ation/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/patch.py
Outdated
Show resolved
Hide resolved
xrmx
reviewed
Jul 31, 2024
instrumentation/opentelemetry-instrumentation-openai/test-requirements.txt
Outdated
Show resolved
Hide resolved
xrmx
reviewed
Jul 31, 2024
...telemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/span_attributes.py
Outdated
Show resolved
Hide resolved
xrmx
reviewed
Jul 31, 2024
...ion/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/version.py
Outdated
Show resolved
Hide resolved
xrmx
reviewed
Jul 31, 2024
...ation/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/patch.py
Outdated
Show resolved
Hide resolved
xrmx
reviewed
Jul 31, 2024
...ation/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/patch.py
Outdated
Show resolved
Hide resolved
...ation/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/patch.py
Outdated
Show resolved
Hide resolved
...ation/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/patch.py
Outdated
Show resolved
Hide resolved
...ation/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/patch.py
Outdated
Show resolved
Hide resolved
…ntrib into openai-opentelemetry
|
|
lmolkova
reviewed
Aug 8, 2024
...ation/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/patch.py
Outdated
Show resolved
Hide resolved
...ation/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/patch.py
Outdated
Show resolved
Hide resolved
...ation/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/patch.py
Outdated
Show resolved
Hide resolved
...ation/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/patch.py
Outdated
Show resolved
Hide resolved
...ation/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/patch.py
Outdated
Show resolved
Hide resolved
...ation/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/patch.py
Outdated
Show resolved
Hide resolved
...ation/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/patch.py
Outdated
Show resolved
Hide resolved
...ation/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/patch.py
Outdated
Show resolved
Hide resolved
...ation/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/patch.py
Outdated
Show resolved
Hide resolved
...ation/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/patch.py
Outdated
Show resolved
Hide resolved
lmolkova
reviewed
Aug 8, 2024
Member
lmolkova
left a comment
There was a problem hiding this comment.
Great start, thanks a lot for doing this!
1. clean up prompt calculations to be deduced from last streaming chunk 2. save correct span name 3. remove recording exceptions and setting status to ok 4. remove saving stream chunks in events
1 task
xrmx
reviewed
Aug 19, 2024
instrumentation/opentelemetry-instrumentation-openai/pyproject.toml
Outdated
Show resolved
Hide resolved
xrmx
reviewed
Aug 19, 2024
...ation/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/patch.py
Outdated
Show resolved
Hide resolved
...ation/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/utils.py
Outdated
Show resolved
Hide resolved
...ation/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/utils.py
Outdated
Show resolved
Hide resolved
...ation/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/utils.py
Outdated
Show resolved
Hide resolved
...ation/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/utils.py
Outdated
Show resolved
Hide resolved
...ation/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/utils.py
Outdated
Show resolved
Hide resolved
lmolkova
pushed a commit
to open-telemetry/opentelemetry-specification
that referenced
this pull request
Aug 28, 2024
…ween external and otel instrumentations (#4187) Some package managers (PyPi) don't provide means to reserve namespaces for projects. We also have a number of **external** instrumentation libraries in python that follow current guidance and use `opentelemetry-instrumentation-{component}` naming pattern. These libraries are hard to distinguish from otel-authored ones. Also, when someone (legitimately following existing guidance) creates an external instrumentation package like this, it blocks our ability to have OTel-authored instrumentation with this 'good' name. See open-telemetry/opentelemetry-python-contrib#2759 (comment) for real-life example. ## Changes This PR changes the recommendation to: - otel authored instrumentation should use `opentelemetry-instrumentation-*` pattern - external instrumentation should not use this pattern and should prefix lib name with their company/project/etc name * ~~[ ] Related issues #~~ * ~~[ ] Related [OTEP(s)](https://github.com/open-telemetry/oteps) #~~ * ~~[ ] Links to the prototypes (when adding or changing features)~~ * [x] [`CHANGELOG.md`](https://github.com/open-telemetry/opentelemetry-specification/blob/main/CHANGELOG.md) file updated for non-trivial changes * ~~[ ] [`spec-compliance-matrix.md`](https://github.com/open-telemetry/opentelemetry-specification/blob/main/spec-compliance-matrix.md) updated if necessary~~ --------- Co-authored-by: Armin Ruech <7052238+arminru@users.noreply.github.com>
…emetry-python-contrib into openai-opentelemetry
xrmx
reviewed
Sep 5, 2024
...on/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/__init__.py
Outdated
Show resolved
Hide resolved
Contributor
|
@lzchen addressed all of the above comments |
xrmx
requested changes
Oct 21, 2024
...ntelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/__init__.py
Outdated
Show resolved
Hide resolved
instrumentation/opentelemetry-instrumentation-openai-v2/test-requirements.txt
Outdated
Show resolved
Hide resolved
lzchen
approved these changes
Oct 21, 2024
Contributor
Author
Thanks for the quick reviews @lzchen ! |
xrmx
reviewed
Oct 22, 2024
...ntelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/__init__.py
Outdated
Show resolved
Hide resolved
xrmx
approved these changes
Oct 22, 2024
Contributor
Author
carlosalberto
pushed a commit
to carlosalberto/opentelemetry-specification
that referenced
this pull request
Oct 31, 2024
…ween external and otel instrumentations (open-telemetry#4187) Some package managers (PyPi) don't provide means to reserve namespaces for projects. We also have a number of **external** instrumentation libraries in python that follow current guidance and use `opentelemetry-instrumentation-{component}` naming pattern. These libraries are hard to distinguish from otel-authored ones. Also, when someone (legitimately following existing guidance) creates an external instrumentation package like this, it blocks our ability to have OTel-authored instrumentation with this 'good' name. See open-telemetry/opentelemetry-python-contrib#2759 (comment) for real-life example. ## Changes This PR changes the recommendation to: - otel authored instrumentation should use `opentelemetry-instrumentation-*` pattern - external instrumentation should not use this pattern and should prefix lib name with their company/project/etc name * ~~[ ] Related issues #~~ * ~~[ ] Related [OTEP(s)](https://github.com/open-telemetry/oteps) #~~ * ~~[ ] Links to the prototypes (when adding or changing features)~~ * [x] [`CHANGELOG.md`](https://github.com/open-telemetry/opentelemetry-specification/blob/main/CHANGELOG.md) file updated for non-trivial changes * ~~[ ] [`spec-compliance-matrix.md`](https://github.com/open-telemetry/opentelemetry-specification/blob/main/spec-compliance-matrix.md) updated if necessary~~ --------- Co-authored-by: Armin Ruech <7052238+arminru@users.noreply.github.com>
|
Thank for the contribution. When is this planned for release? |
Contributor
Author
Member
|
it will be released separately (now and in the future), release is still in progress, got stuck on some minor issues. Hope to finish tomorrow. |
Contributor
Author
Thanks @lmolkova |
6 tasks
xrmx
pushed a commit
to xrmx/opentelemetry-python-contrib
that referenced
this pull request
Jan 24, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds support for tracing the official python openai library.
This pull request introduces initial support for instrumenting the OpenAI Python library, specifically targeting the chat.completion.create method. This implementation aligns with the GenAI semantic conventions.
Fixes #1796
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
This is a work in progress PR at the moment and I plan to add unit tests and update this space.
Does This PR Require a Core Repo Change?
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.