feat: emit OTel gen_ai.client.* metrics natively
gen_ai.client.operation.duration and gen_ai.client.token.usage already exist in OTel semconv (https://opentelemetry.io/docs/specs/semconv/gen-ai/gen-ai-metrics/), and are currently emitted by https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/instrumentation-genai/opentelemetry-instrumentation-google-genai, if configured. However, they have no agentic attributes. This change builds on top of the recently introduced metric instrumentation and emits those two metrics a new attribute: gen_ai.agent.name. In the future, gen_ai.agent.version will also be set. Semconv updates will be handled separately. When the google-genai instrumentation lib is active for a Gemini agent, we don't re-emit the gen_ai.client.* metrics to avoid double-counting. Change-Id: Ie610d25ca44671d3a31d4307ebf068a1c9deeaab
M
Marcin Vinietowicz committed
0bb329ba53ad356a70e73377fff4f429ffa99961
Parent: 460cb8c
Committed by George Weale <gweale@google.com>
on 5/28/2026, 6:41:01 PM