openllmetry icon indicating copy to clipboard operation
openllmetry copied to clipboard

🚀 Feature: Instrument the new google genai library

Open dinmukhamedm opened this issue 1 year ago • 4 comments

Which component is this feature for?

Google Generative AI Instrumentation

🔖 Feature description

We need a separate package, perhaps opentelemetry-instrumentation-genai to instrument google's newer google-genai SDK.

  1. https://pypi.org/project/google-genai/
  2. https://discuss.ai.google.dev/t/google-generativeai-vs-python-genai/53873/

🎤 Why is this feature needed ?

As per discussion link [2] above, the library will eventually replace the older lower-level APIs.

✌️ How do you aim to achieve this?

By creating a separate instrumentation library

🔄️ Additional Information

No response

👀 Have you spent some time to check if this feature request has been raised before?

  • [x] I checked and didn't find similar issue

Are you willing to submit PR?

None

dinmukhamedm avatar Feb 23 '25 06:02 dinmukhamedm

@nirga actually I am willing to submit a PR, but have no time to do this now. So I am happy if somebody else in the community picks this up.

Also, how does this align with #2456? Should the new library already send just events or should we start with attributes for now?

dinmukhamedm avatar Feb 23 '25 06:02 dinmukhamedm

@dinmukhamedm for #2456 the goal is to start sending both events and attributes to align with approved otel semantic conventions while easing migration. In the long term, we might have a mechanism in the SDK to translate events -> attributes. That way, the instrumentations themselves can be aligned with semantic conventions (emitting events) while the SDK keeps the way we work today (which is better IMO 😅 ).

nirga avatar Feb 23 '25 07:02 nirga

I am also in need of this!

TheMellyBee avatar Mar 27 '25 13:03 TheMellyBee

Note that there is an instrumentation for the Google Gen AI SDK in the Open Telemetry Python Contrib repo:

https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/instrumentation-genai/opentelemetry-instrumentation-google-genai

michaelsafyan avatar Apr 21 '25 20:04 michaelsafyan

Closing in favour of existing instrumentation that wraps some methods and the contrib implementation that works with log events

dinmukhamedm avatar Jul 29 '25 17:07 dinmukhamedm