Skip to content

[Agent Server] Add managed OTLP gRPC export support#48106

Open
Shivakishore14 wants to merge 12 commits into
Azure:mainfrom
Shivakishore14:otlp-protocol-regression-tests-copy
Open

[Agent Server] Add managed OTLP gRPC export support#48106
Shivakishore14 wants to merge 12 commits into
Azure:mainfrom
Shivakishore14:otlp-protocol-regression-tests-copy

Conversation

@Shivakishore14

@Shivakishore14 Shivakishore14 commented Jul 17, 2026

Copy link
Copy Markdown
Member

Description

Adds Agent Server-managed OTLP/gRPC export support while keeping the default OTLP HTTP/protobuf path delegated to microsoft-opentelemetry.

  • Detects OTEL_EXPORTER_OTLP_PROTOCOL=grpc and configures gRPC trace, metric, and log exporters from Agent Server.
  • Keeps customer setup env-var based; customers do not need to pass custom span processors.
  • Temporarily hides OTLP env vars from the distro in gRPC mode so it does not also create HTTP/protobuf exporters.
  • Adds loopback OTLP HTTP/protobuf and gRPC regression tests for traces, metrics, and logs.
  • Documents the OTLP/gRPC env-var configuration.

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.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

Validation

  • azpysdk mindependency .: passes
  • azpysdk devtest . --pytest-args tests/test_otlp_protocol.py tests/test_tracing.py::TestFoundryEnrichmentSpanProcessor: 15 passed

Use in-process HTTP/protobuf and gRPC receivers to verify traces, metrics, and logs through the public observability setup.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 2ddb2a79-14d1-4372-a29d-8a0c65a55b7b
Add Agent Server-managed OTLP gRPC exporter setup when customers configure OTEL_EXPORTER_OTLP_PROTOCOL=grpc, while leaving HTTP/protobuf export delegated to the Microsoft OpenTelemetry distro.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0c368201-b3c0-4a22-8311-2c288cbd374c
Apply Foundry enrichment during on_end and update the private attribute workaround for immutable BoundedAttributes so exported spans retain Agent Server metadata.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0c368201-b3c0-4a22-8311-2c288cbd374c
Keep span enrichment compatible with newer OpenTelemetry SDKs and tighten the OTLP gRPC exporter dependency to avoid slow resolver installs in apistub.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0c368201-b3c0-4a22-8311-2c288cbd374c
@github-actions github-actions Bot added the Hosted Agents sdk/agentserver/* label Jul 17, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
9 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Disable apistub for azure-ai-agentserver-core because the package has no public API surface changes and the gRPC exporter dependency causes the apistub wheel install to exceed the check timeout.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0c368201-b3c0-4a22-8311-2c288cbd374c
Align the package version with the unreleased changelog entry and add Azure SDK docstring metadata for the OTLP gRPC helper.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0c368201-b3c0-4a22-8311-2c288cbd374c
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0c368201-b3c0-4a22-8311-2c288cbd374c
@Shivakishore14 Shivakishore14 changed the title [Agent Server] Add OTLP protocol regression tests [Agent Server] Add managed OTLP gRPC export support Jul 17, 2026
@Shivakishore14
Shivakishore14 marked this pull request as ready for review July 17, 2026 08:14
Copilot AI review requested due to automatic review settings July 17, 2026 08:14
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
9 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Keep apistub enabled for azure-ai-agentserver-core; the dependency constraint fix allows the check to complete.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0c368201-b3c0-4a22-8311-2c288cbd374c

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds Agent Server-managed OTLP/gRPC telemetry export while preserving the existing HTTP/protobuf path.

Changes:

  • Configures gRPC exporters for traces, metrics, and logs.
  • Adds loopback protocol regression tests and dependencies.
  • Updates documentation, changelog, and package version.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
_tracing.py Implements managed gRPC export and enrichment handling.
test_otlp_protocol.py Tests HTTP/protobuf and gRPC signal export.
README.md Documents gRPC configuration.
pyproject.toml Adds exporter dependency and build configuration.
dev_requirements.txt Adds test dependencies.
CHANGELOG.md Records the feature and tests.
_version.py Bumps the package to 2.0.0b8.
Comments suppressed due to low confidence (1)

sdk/agentserver/azure-ai-agentserver-core/pyproject.toml:64

  • This disables ApiStubGen for the whole package, even though this package already tracks api.md/api.metadata.yml and the repository requires the analyze job to produce a reviewable public API stub (doc/eng_sys_checks.md:336). The OTLP implementation only changes private internals, so this opt-out is unrelated and would allow future API changes to bypass APIView validation. Keep the check enabled.

Comment on lines +5 to +8
### Other Changes

- Added local OTLP HTTP/protobuf and gRPC protocol regression tests covering traces, metrics, and logs without requiring external collector infrastructure.
- Added Agent Server-managed OTLP/gRPC export when `OTEL_EXPORTER_OTLP_PROTOCOL=grpc` is configured.
Constrain Agent Server OpenTelemetry dependencies to the microsoft-opentelemetry-compatible 1.43 line so apistub can install the wheel without resolver backtracking timeouts.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0c368201-b3c0-4a22-8311-2c288cbd374c
Add Agent Server runtime dependencies to dev requirements so CI preinstalls them before apistub installs the package wheel.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0c368201-b3c0-4a22-8311-2c288cbd374c
@Shivakishore14
Shivakishore14 marked this pull request as ready for review July 17, 2026 10:13
Copilot AI review requested due to automatic review settings July 17, 2026 10:13
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
9 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Comment on lines +222 to +224
context = _without_otlp_env() if suppress_distro_otlp else nullcontext()
with context:
_setup_distro_export(
Comment on lines +347 to +350
def _resolve_otlp_protocol() -> str:
protocol = os.environ.get(_OTLP_PROTOCOL) or _OTLP_HTTP_PROTOBUF
normalized = protocol.strip().lower()
if normalized not in (_OTLP_HTTP_PROTOBUF, _OTLP_GRPC):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Hosted Agents sdk/agentserver/*

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants