Skip to content

Add GenAI main-agent attribution processor#46700

Open
rads-1996 wants to merge 8 commits intoAzure:mainfrom
rads-1996:implement-genai-spec
Open

Add GenAI main-agent attribution processor#46700
rads-1996 wants to merge 8 commits intoAzure:mainfrom
rads-1996:implement-genai-spec

Conversation

@rads-1996
Copy link
Copy Markdown
Member

@rads-1996 rads-1996 commented May 4, 2026

Description

Add GenAI main-agent attribution processors to propagate microsoft.gen_ai.main_agent.* attributes in multi-agent systems. Implements spec.

Distro changes - #46703. The exporter needs to be released first.

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

Copilot AI review requested due to automatic review settings May 4, 2026 19:04
@github-actions github-actions Bot added the Monitor - Exporter Monitor OpenTelemetry Exporter label May 4, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds new GenAI processors intended to propagate microsoft.gen_ai.main_agent.* attributes across spans and log records for multi-agent tracing scenarios.

Changes:

  • Introduces a span processor that propagates main-agent attributes from parent spans and self-attributes invoke_agent spans on end.
  • Introduces a log record processor that copies main-agent attributes from the current span onto emitted logs.
  • Adds changelog and unit tests for the new propagation behavior.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_gen_ai/_processor.py Adds the new GenAI span/log processors and attribute mapping logic.
sdk/monitor/azure-monitor-opentelemetry-exporter/tests/test_gen_ai_processor.py Adds unit tests covering the new processor behaviors.
sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_gen_ai/__init__.py Creates the new _gen_ai package.
sdk/monitor/azure-monitor-opentelemetry-exporter/CHANGELOG.md Documents the new GenAI main-agent attribution feature.
Comments suppressed due to low confidence (1)

sdk/monitor/azure-monitor-opentelemetry-exporter/tests/test_gen_ai_processor.py:1

  • The new fallback branch that writes directly to log_record.attributes is untested. The added tests only exercise the nested log_record.log_record.attributes path, so a regression in this compatibility branch would not be caught.
# Copyright (c) Microsoft Corporation. All rights reserved.

@rads-1996 rads-1996 force-pushed the implement-genai-spec branch from 85b8338 to 96b0cfc Compare May 4, 2026 20:55
Copy link
Copy Markdown
Member

@JacksonWeber JacksonWeber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Monitor - Exporter Monitor OpenTelemetry Exporter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants