feat: Add Spectra Collector exporter integration#197
feat: Add Spectra Collector exporter integration#197juliomenendez wants to merge 10 commits intomainfrom
Conversation
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>
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
There was a problem hiding this comment.
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
SpectraExporterOptionsand extendsconfigure()to dispatch between Agent365 vs Spectra export paths. - Moves
suppress_invoke_agent_inputhandling into_EnrichingBatchSpanProcessorand adds attribute exclusion support viaEnrichedReadableSpan. - 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. |
...vability-core/microsoft_agents_a365/observability/core/exporters/spectra_exporter_options.py
Show resolved
Hide resolved
.../microsoft-agents-a365-observability-core/microsoft_agents_a365/observability/core/config.py
Show resolved
Hide resolved
- 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>
There was a problem hiding this comment.
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
SpectraExporterOptionsand updateconfigure()/TelemetryManager to dispatch between Agent365 and Spectra exporters. - Move
suppress_invoke_agent_inputbehavior into_EnrichingBatchSpanProcessorand extendEnrichedReadableSpanto support attribute exclusion. - Export
Agent365ExporterOptionsandSpectraExporterOptionsvia 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. |
Summary
SpectraExporterOptionsclass for exporting traces to Spectra Collector sidecars via OTLP (gRPC or HTTP)configure()to acceptSpectraExporterOptions | Agent365ExporterOptions | Nonewithisinstance-based dispatchsuppress_invoke_agent_inputfrom_Agent365Exporter._map_span()to_EnrichingBatchSpanProcessor.on_end()so it works with any exporterEnrichedReadableSpanwithexcluded_attribute_keysfor attribute removalAgent365ExporterOptionsandSpectraExporterOptionsfrom the public APIBackward Compatibility
All changes are fully backward compatible:
_Agent365Exporterand_EnrichingBatchSpanProcessorare private (underscore prefix, not exported)EnrichedReadableSpan) are optional with defaultsconfigure()type is widened (union), not narrowed — existing callers unaffectedAgent365ExporterOptionsclassConsumer Usage
Design
See
docs/design/spectra-exporter-options.mdfor the full design document.Test plan
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)test_agent365.pyregression test for_Agent365Exportercall signaturetest_prompt_suppression.pyfor processor-based suppression🤖 Generated with Claude Code