Skip to content

feat: Add Spectra Collector exporter integration#197

Open
juliomenendez wants to merge 10 commits intomainfrom
juliome/spectra-exporter-option
Open

feat: Add Spectra Collector exporter integration#197
juliomenendez wants to merge 10 commits intomainfrom
juliome/spectra-exporter-option

Conversation

@juliomenendez
Copy link
Contributor

Summary

  • Adds SpectraExporterOptions class for exporting traces to Spectra Collector sidecars via OTLP (gRPC or HTTP)
  • Extends configure() to accept SpectraExporterOptions | Agent365ExporterOptions | None with isinstance-based dispatch
  • Moves suppress_invoke_agent_input from _Agent365Exporter._map_span() to _EnrichingBatchSpanProcessor.on_end() so it works with any exporter
  • Extends EnrichedReadableSpan with excluded_attribute_keys for attribute removal
  • Exports both Agent365ExporterOptions and SpectraExporterOptions from the public API

Backward Compatibility

All changes are fully backward compatible:

  • _Agent365Exporter and _EnrichingBatchSpanProcessor are private (underscore prefix, not exported)
  • New parameters on public classes (EnrichedReadableSpan) are optional with defaults
  • configure() type is widened (union), not narrowed — existing callers unaffected
  • No changes to Agent365ExporterOptions class

Consumer Usage

from microsoft_agents_a365.observability.core import configure, SpectraExporterOptions

# Zero-config for K8s sidecar (localhost:4317, gRPC, insecure)
configure(
    service_name="weave-agent",
    service_namespace="copilot-cowork",
    exporter_options=SpectraExporterOptions(),
)

Design

See docs/design/spectra-exporter-options.md for the full design document.

Test plan

  • 13 new tests in test_spectra_exporter.py (options defaults, validation, gRPC/HTTP dispatch, batch settings, env var isolation, OTLP bolt-on interaction, suppress_invoke_agent_input, enriched span exclusion)
  • Updated test_agent365.py regression test for _Agent365Exporter call signature
  • Updated test_prompt_suppression.py for processor-based suppression
  • All 164 observability tests pass (1 skipped, 3 deselected)
  • Lint and format clean

🤖 Generated with Claude Code

juliomenendez and others added 8 commits March 14, 2026 12:10
Design document and brainstorm outputs for adding SpectraExporterOptions
to observability-core, enabling Weave/Copilot Cowork to export traces via
OTLP to Spectra Collector sidecars instead of the A365 API.

Key decisions:
- New SpectraExporterOptions class with K8s sidecar defaults
- Union type dispatch on configure() exporter_options parameter
- Move suppress_invoke_agent_input to enrichment layer for exporter-agnostic suppression
- Protocol validation, module-level gRPC import, export surface symmetry

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…export

Introduces SpectraExporterOptions with fields for endpoint, protocol
(grpc/http), insecure flag, and batch settings. Defaults are tuned for
K8s sidecar topology (localhost:4317, gRPC, insecure).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Extends EnrichedReadableSpan with an optional excluded_attribute_keys
parameter that removes specified keys after merging extras. Existing
callers are unaffected (defaults to empty set).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…cessor

Moves the InvokeAgent input message suppression from
_Agent365Exporter._map_span() to _EnrichingBatchSpanProcessor.on_end()
so it works with any exporter (A365, Spectra, or OTLP bolt-on).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds isinstance-based dispatch in _configure_internal() to create
GrpcOTLPSpanExporter or OTLPSpanExporter when SpectraExporterOptions
is provided. Updates exporter_options type to union on all three
configure() signatures.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…public API

Adds both exporter options classes to the core package's public API
for consistent import ergonomics.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds test_spectra_exporter.py with 13 tests covering:
- SpectraExporterOptions defaults and validation
- configure() with Spectra options (gRPC, HTTP, custom endpoint)
- A365 env var ignored when Spectra options provided
- Batch settings extraction, OTLP bolt-on interaction
- suppress_invoke_agent_input in batch processor
- EnrichedReadableSpan excluded_attribute_keys

Updates test_agent365.py to reflect suppress_invoke_agent_input
being moved from _Agent365Exporter to _EnrichingBatchSpanProcessor.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Updates test_prompt_suppression.py to test suppress_invoke_agent_input
on _EnrichingBatchSpanProcessor instead of _Agent365Exporter, reflecting
the refactor that moved suppression to the processor layer.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@juliomenendez juliomenendez requested review from a team as code owners March 14, 2026 18:36
Copilot AI review requested due to automatic review settings March 14, 2026 18:36
@github-actions
Copy link

github-actions bot commented Mar 14, 2026

⚠️ Deprecation Warning: The deny-licenses option is deprecated for possible removal in the next major release. For more information, see issue 997.

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

Copy link
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

Adds first-class support in microsoft-agents-a365-observability-core to export traces to a Spectra Collector sidecar via standard OTLP, while keeping the existing Agent365 exporter path intact and making prompt suppression exporter-agnostic.

Changes:

  • Introduces SpectraExporterOptions and extends configure() to dispatch between Agent365 vs Spectra export paths.
  • Moves suppress_invoke_agent_input handling into _EnrichingBatchSpanProcessor and adds attribute exclusion support via EnrichedReadableSpan.
  • Adds/updates observability tests and accompanying design/brainstorm documentation.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
tests/observability/extensions/openai/test_prompt_suppression.py Updates suppression configuration tests to target the span processor instead of the Agent365 exporter.
tests/observability/core/test_spectra_exporter.py Adds coverage for Spectra options defaults/validation, configure dispatch, and suppression/exclusion behavior.
tests/observability/core/test_agent365.py Updates regression expectation for Agent365 exporter constructor call signature.
libraries/microsoft-agents-a365-observability-core/microsoft_agents_a365/observability/core/exporters/spectra_exporter_options.py Adds new options class for Spectra OTLP exporter configuration.
libraries/microsoft-agents-a365-observability-core/microsoft_agents_a365/observability/core/exporters/enriching_span_processor.py Adds suppression logic at the processor layer so it applies to any exporter.
libraries/microsoft-agents-a365-observability-core/microsoft_agents_a365/observability/core/exporters/enriched_span.py Extends enriched span wrapper to support removing specific attributes.
libraries/microsoft-agents-a365-observability-core/microsoft_agents_a365/observability/core/exporters/agent365_exporter.py Removes exporter-specific suppression logic/args now handled upstream in the processor.
libraries/microsoft-agents-a365-observability-core/microsoft_agents_a365/observability/core/exporters/init.py Exposes SpectraExporterOptions from the exporters package API.
libraries/microsoft-agents-a365-observability-core/microsoft_agents_a365/observability/core/config.py Adds OTLP gRPC exporter import and type-based exporter selection; wires suppression into the batch processor.
libraries/microsoft-agents-a365-observability-core/microsoft_agents_a365/observability/core/init.py Exports both Agent365ExporterOptions and SpectraExporterOptions from the core public API.
docs/design/spectra-exporter-options.md Adds the detailed design document for Spectra integration and suppression refactor.
docs/brainstorm/spectra-collector-integration/TLDR.md Adds a short stakeholder summary of the planned integration.
docs/brainstorm/spectra-collector-integration/BRAINSTORM.md Adds the brainstorm working document capturing decisions/risks/context.
docs/brainstorm/spectra-collector-integration/ARCHITECTURE.md Adds an architecture proposal for the Spectra exporter integration.

juliomenendez and others added 2 commits March 14, 2026 12:49
- Make default endpoint protocol-aware: 4317 for gRPC, 4318 for HTTP
- Add suppress_invoke_agent_input as explicit param on public configure()
- Fix insecure default from False to True in brainstorm docs (BRAINSTORM.md,
  TLDR.md, ARCHITECTURE.md) to match implementation
- Add tests for HTTP default endpoint and explicit endpoint override

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 14, 2026 18:53
Copy link
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

Adds first-class Spectra Collector sidecar export support to microsoft-agents-a365-observability-core by introducing SpectraExporterOptions and wiring configure() to select an OTLP exporter (gRPC/HTTP) via type-based dispatch, while making prompt suppression exporter-agnostic.

Changes:

  • Add SpectraExporterOptions and update configure()/TelemetryManager to dispatch between Agent365 and Spectra exporters.
  • Move suppress_invoke_agent_input behavior into _EnrichingBatchSpanProcessor and extend EnrichedReadableSpan to support attribute exclusion.
  • Export Agent365ExporterOptions and SpectraExporterOptions via public APIs; add/adjust tests and design docs.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/observability/extensions/openai/test_prompt_suppression.py Updates suppression tests to validate processor-based suppression and removes emoji output.
tests/observability/core/test_spectra_exporter.py Adds coverage for Spectra options defaults/validation, exporter selection, batching kwargs, env var interactions, and suppression behavior.
tests/observability/core/test_agent365.py Adjusts expectation for _Agent365Exporter call signature after suppression handling moved to processor.
libraries/.../exporters/spectra_exporter_options.py New options class for Spectra OTLP export with gRPC/HTTP protocol support and batching settings.
libraries/.../exporters/enriching_span_processor.py Adds suppression flag and strips invoke-agent input via EnrichedReadableSpan exclusions before batching.
libraries/.../exporters/enriched_span.py Extends wrapper to support removing attributes via excluded_attribute_keys.
libraries/.../exporters/agent365_exporter.py Removes suppression config and suppression logic from _map_span() to keep exporter focused on A365 serialization.
libraries/.../exporters/init.py Exposes SpectraExporterOptions alongside Agent365ExporterOptions.
libraries/.../core/config.py Adds gRPC OTLP exporter import, widens exporter_options union, and implements isinstance-based exporter selection; passes suppression to batch processor.
libraries/.../core/init.py Exposes Agent365ExporterOptions and SpectraExporterOptions from the top-level core package API.
docs/design/spectra-exporter-options.md Adds detailed design doc for Spectra exporter integration and suppression move.
docs/brainstorm/spectra-collector-integration/TLDR.md Adds stakeholder-facing summary of the Spectra integration approach.
docs/brainstorm/spectra-collector-integration/BRAINSTORM.md Adds brainstorming notes, requirements, and decisions for the Spectra work.
docs/brainstorm/spectra-collector-integration/ARCHITECTURE.md Adds architecture proposal for exporter selection and public API exposure.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants