[pull] main from google:main#399
Merged
Merged
Conversation
The `gen_ai.workflow.nested=true` attribute/dimension was never produced for any nested workflow in `gen_ai.invoke_workflow.duration` metric, so root and nested workflow invocations could not be distinguished. Root cause was a lost OpenTelemetry context value in `_use_invoke_workflow_span`. The "entrypoint workflow active" marker was only `set_value`'d onto the local `otel_context` handed to `tracer.start_as_current_span(context=...)`. OTel uses that argument solely to resolve the new span's parent; it does not attach it as the current context. The child telemetry context was then captured from `context_api.get_current()`, which never carried the marker, so every downstream workflow computed `nested=False`. Fix: after starting the span, `context_api.attach` the marker onto the current context (and `detach` on exit) so child nodes capturing `get_current()` observe `nested=True`. The now-redundant `set_value` onto the local context is removed. Extend the telemetry functional tests so the scenario runs a workflow nested inside a workflow. All expected span trees and the invoke_workflow duration metric now assert the inner workflow carries `gen_ai.workflow.nested=true` while the root omits it. This case previously went uncovered. Co-authored-by: Max Ind <maxind@google.com> PiperOrigin-RevId: 943153631
Semconv PR for this metric in: open-telemetry/semantic-conventions-genai#203 Was replaced by `gen_ai.invoke_agent.{inference,tool}_calls` metrics in: open-telemetry/semantic-conventions-genai#336 We're hence removing the non-standard and less defined `gen_ai.agent.workflow.steps` metric. Co-authored-by: Max Ind <maxind@google.com> PiperOrigin-RevId: 943154162
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )