Set gen_ai.workflow.name span attribute on workflow invocations#275
Open
lmolkova wants to merge 3 commits into
Open
Set gen_ai.workflow.name span attribute on workflow invocations#275lmolkova wants to merge 3 commits into
gen_ai.workflow.name span attribute on workflow invocations#275lmolkova wants to merge 3 commits into
Conversation
WorkflowInvocation now sets gen_ai.workflow.name at span creation when the workflow name is known, so it is available for sampling. Also add a rego live-check manifest for invoke_workflow (expected attributes and span-name format) that enforces gen_ai.workflow.name is emitted.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the shared opentelemetry-util-genai workflow invocation implementation to emit gen_ai.workflow.name as a span attribute at span creation time (when the workflow name is known), so it’s available to samplers. It also tightens validation by extending the GenAI span live-check policy to cover invoke_workflow span-name formatting and expected attributes.
Changes:
- Emit
gen_ai.workflow.nameinWorkflowInvocationbase (start-span) attributes whennameis provided. - Add unit tests asserting the workflow-name attribute is present when provided and omitted when
None, including a sampling-time capture assertion. - Extend
policies/genai_span_validation.regoto validateinvoke_workflowspan-name formatting keyed bygen_ai.workflow.nameand to require the attribute in the expected manifest.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| util/opentelemetry-util-genai/tests/test_handler_workflow.py | Adds tests for gen_ai.workflow.name emission/omission and verifies it’s available during sampling. |
| util/opentelemetry-util-genai/src/opentelemetry/util/genai/_workflow_invocation.py | Adds conditional gen_ai.workflow.name to base attributes used at span creation time. |
| util/opentelemetry-util-genai/.changelog/+workflow-name-attribute.fixed | Adds a changelog fragment describing the behavior change (but filename does not match CI requirements). |
| policies/genai_span_validation.rego | Adds invoke_workflow span-name keyed attribute and expected-attribute manifest entries. |
Pull request dashboard status
|
eternalcuriouslearner
approved these changes
Jul 16, 2026
…ribute Renames the changelog fragment to 275.fixed to satisfy the changelog CI check, and expands the _get_base_attributes docstring to note the conditional gen_ai.workflow.name attribute. Assisted-by: Claude Opus 4.8
…n-attribute # Conflicts: # policies/genai_span_validation.rego
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.
WorkflowInvocation now sets
gen_ai.workflow.nameat span creation when the workflow name is known, so it is available for sampling.Also add a rego live-check manifest for invoke_workflow (expected attributes and span-name format) that enforces gen_ai.workflow.name is emitted.