opentelemetry-util-genai: add support for emitting inference events and enrich message types#3994
Conversation
|
Typecheck failure is not related to this PR, so it may be ignored. cc @aabmass |
Change-Id: I8fd0b896fc103a986f78c7351ce627611e545a62 Co-developed-by: Cursor <noreply@cursor.com>
Change-Id: I5c4c93613e3e1084245b7298955a08cbc7c9708d Co-developed-by: Cursor <noreply@cursor.com>
Change-Id: If34cfce0e7eb130db6a1e8e30a5f4be7c215285f Co-developed-by: Cursor <noreply@cursor.com>
Change-Id: I847f75259e01729db88129a44b241afb0ea2aca4 Co-developed-by: Cursor <noreply@cursor.com>
Change-Id: I818a042d275d3c8e3348647d73e34560e7d92f54 Co-developed-by: Cursor <noreply@cursor.com>
fbce5a2 to
1d312c5
Compare
Change-Id: I40b8e01bbe4fa9c182e99085a7c71d4536042247 Co-developed-by: Cursor <noreply@cursor.com>
Change-Id: Ie07c495002143fb2f0cf88033206290eb85386ad Co-developed-by: Cursor <noreply@cursor.com>
util/opentelemetry-util-genai/src/opentelemetry/util/genai/span_utils.py
Show resolved
Hide resolved
util/opentelemetry-util-genai/src/opentelemetry/util/genai/span_utils.py
Outdated
Show resolved
Hide resolved
util/opentelemetry-util-genai/src/opentelemetry/util/genai/span_utils.py
Show resolved
Hide resolved
|
I think changing some of the apply attributes methods to output a dictionary instead of attaching the attributes for events sake is ok, though making the methods llm specific will lead to a lot of overlapping code overtime if more genai types are implemented in the future. More so applies to methods like _apply_common_span_attributes, _apply_finish_attributes, etc, which could take different genai type invocations. |
@JWinermaSplunk Thanks for your suggestions! We do need to classify the attributes for common, inference, agent and so on to reuse them as much as possible. However, I don't want to involve many features in this PR because that means we'd better refactor the design of Could you please create another issue to mark this proposal? I believe @keith-decker and @aabmass would also be interested in this. |
Change-Id: I1da48b52b76042a9efd124057681f579cc93fb6e Co-developed-by: Cursor <noreply@cursor.com>
Change-Id: I1b9f40e5576e699b1f61fa3d7e7790ee4b1448a5 Co-developed-by: Cursor <noreply@cursor.com>
Change-Id: I7adf6fc9cf0bcbed3927862ff87d441bb2a1f78b Co-developed-by: Cursor <noreply@cursor.com>
Change-Id: I4a6f48d0f66b8ad00a6ce4be8dcf4a46aba68e33 Co-developed-by: Cursor <noreply@cursor.com>
76cadd6 to
1734709
Compare
|
This PR looks good to me. I agree with @JWinermaSplunk about the duplication of attributes. Once we add the next type (Tool, Agent, etc.) it'll be a great time to refactor those invocations to be more generic. |
Change-Id: Ied7182fe2f3493a1eba96d7eaae5fd1b790c16e7 Co-developed-by: Cursor <noreply@cursor.com>
Change-Id: I95472013fe59b2b7a7448bb4374fe103021ec8a1 Co-developed-by: Cursor <noreply@cursor.com>
Change-Id: I78008c9b812d81a705eb7e7c75bd622b47d9da5a Co-developed-by: Cursor <noreply@cursor.com>
util/opentelemetry-util-genai/src/opentelemetry/util/genai/span_utils.py
Outdated
Show resolved
Hide resolved
|
LGTM. Thanks |
Change-Id: I243cc757454c085818d621011435076bf501108d Co-developed-by: Cursor <noreply@cursor.com>
|
@xrmx Hello, could you please help merge this PR? I believe it's all set. |
|
Hey @Cirilla-zmh sorry for the delay. If you fix the conflicts, I've marked it auto merge. |
Head branch was pushed to by a user without write access
Change-Id: If8bfaf1fde5594f7918c195243db9ec83f156156 Co-developed-by: Cursor <noreply@cursor.com>
Hey @aabmass , I have fixed the conflicts. But there're several tests are failed, which is not related to this PR. Could you please ignore these failing checks? Or should we fix this issue first in #4180? cc @xrmx |
…nd enrich message types (open-telemetry#3994) * Add support for emitting inference events and enrich message types Change-Id: I8fd0b896fc103a986f78c7351ce627611e545a62 Co-developed-by: Cursor <noreply@cursor.com> * Add change log Change-Id: I5c4c93613e3e1084245b7298955a08cbc7c9708d Co-developed-by: Cursor <noreply@cursor.com> * Fix unit tests Change-Id: If34cfce0e7eb130db6a1e8e30a5f4be7c215285f Co-developed-by: Cursor <noreply@cursor.com> * Fix linting failure Change-Id: I847f75259e01729db88129a44b241afb0ea2aca4 Co-developed-by: Cursor <noreply@cursor.com> * Fix readme Change-Id: I818a042d275d3c8e3348647d73e34560e7d92f54 Co-developed-by: Cursor <noreply@cursor.com> * Format codes Change-Id: I40b8e01bbe4fa9c182e99085a7c71d4536042247 Co-developed-by: Cursor <noreply@cursor.com> * Fix missing trace context in events Change-Id: Ie07c495002143fb2f0cf88033206290eb85386ad Co-developed-by: Cursor <noreply@cursor.com> * feedback Change-Id: Ida0c2305d950d978c31eb04a80e21e947fabdfba Co-developed-by: Cursor <noreply@cursor.com> * fix type check Change-Id: I1da48b52b76042a9efd124057681f579cc93fb6e Co-developed-by: Cursor <noreply@cursor.com> * Fix the span name of LLM invocations Change-Id: I1b9f40e5576e699b1f61fa3d7e7790ee4b1448a5 Co-developed-by: Cursor <noreply@cursor.com> * Fix span name Change-Id: I7adf6fc9cf0bcbed3927862ff87d441bb2a1f78b Co-developed-by: Cursor <noreply@cursor.com> * Fix operation name of llm span Change-Id: I4a6f48d0f66b8ad00a6ce4be8dcf4a46aba68e33 Co-developed-by: Cursor <noreply@cursor.com> * Adjust event emission switches to optimize the integration experience Change-Id: Ied7182fe2f3493a1eba96d7eaae5fd1b790c16e7 Co-developed-by: Cursor <noreply@cursor.com> * Resolve conflicts Change-Id: I95472013fe59b2b7a7448bb4374fe103021ec8a1 Co-developed-by: Cursor <noreply@cursor.com> * Fix lint error Change-Id: I78008c9b812d81a705eb7e7c75bd622b47d9da5a Co-developed-by: Cursor <noreply@cursor.com> * Refactor span_utils.py to streamline attribute collection Change-Id: I243cc757454c085818d621011435076bf501108d Co-developed-by: Cursor <noreply@cursor.com> * Fix the lint error Change-Id: If8bfaf1fde5594f7918c195243db9ec83f156156 Co-developed-by: Cursor <noreply@cursor.com> --------- Co-authored-by: Aaron Abbott <aaronabbott@google.com>
…nd enrich message types (open-telemetry#3994) * Add support for emitting inference events and enrich message types Change-Id: I8fd0b896fc103a986f78c7351ce627611e545a62 Co-developed-by: Cursor <noreply@cursor.com> * Add change log Change-Id: I5c4c93613e3e1084245b7298955a08cbc7c9708d Co-developed-by: Cursor <noreply@cursor.com> * Fix unit tests Change-Id: If34cfce0e7eb130db6a1e8e30a5f4be7c215285f Co-developed-by: Cursor <noreply@cursor.com> * Fix linting failure Change-Id: I847f75259e01729db88129a44b241afb0ea2aca4 Co-developed-by: Cursor <noreply@cursor.com> * Fix readme Change-Id: I818a042d275d3c8e3348647d73e34560e7d92f54 Co-developed-by: Cursor <noreply@cursor.com> * Format codes Change-Id: I40b8e01bbe4fa9c182e99085a7c71d4536042247 Co-developed-by: Cursor <noreply@cursor.com> * Fix missing trace context in events Change-Id: Ie07c495002143fb2f0cf88033206290eb85386ad Co-developed-by: Cursor <noreply@cursor.com> * feedback Change-Id: Ida0c2305d950d978c31eb04a80e21e947fabdfba Co-developed-by: Cursor <noreply@cursor.com> * fix type check Change-Id: I1da48b52b76042a9efd124057681f579cc93fb6e Co-developed-by: Cursor <noreply@cursor.com> * Fix the span name of LLM invocations Change-Id: I1b9f40e5576e699b1f61fa3d7e7790ee4b1448a5 Co-developed-by: Cursor <noreply@cursor.com> * Fix span name Change-Id: I7adf6fc9cf0bcbed3927862ff87d441bb2a1f78b Co-developed-by: Cursor <noreply@cursor.com> * Fix operation name of llm span Change-Id: I4a6f48d0f66b8ad00a6ce4be8dcf4a46aba68e33 Co-developed-by: Cursor <noreply@cursor.com> * Adjust event emission switches to optimize the integration experience Change-Id: Ied7182fe2f3493a1eba96d7eaae5fd1b790c16e7 Co-developed-by: Cursor <noreply@cursor.com> * Resolve conflicts Change-Id: I95472013fe59b2b7a7448bb4374fe103021ec8a1 Co-developed-by: Cursor <noreply@cursor.com> * Fix lint error Change-Id: I78008c9b812d81a705eb7e7c75bd622b47d9da5a Co-developed-by: Cursor <noreply@cursor.com> * Refactor span_utils.py to streamline attribute collection Change-Id: I243cc757454c085818d621011435076bf501108d Co-developed-by: Cursor <noreply@cursor.com> * Fix the lint error Change-Id: If8bfaf1fde5594f7918c195243db9ec83f156156 Co-developed-by: Cursor <noreply@cursor.com> --------- Co-authored-by: Aaron Abbott <aaronabbott@google.com>
Description
gen_ai.system_instructionsattributes for inference span or events.span_utils.pyfor more brief implementation.Reasoning,Blob,File,Urimessage types.Fixes #3065
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.