Skip to content

Conversation

@nikhilNava
Copy link
Contributor

@nikhilNava nikhilNava commented Jan 5, 2026

Task

  1. Fix initialization logic which did not add all the span processors
  2. Add checks to prevent initialization of Agent365Exporter - https://msazure.visualstudio.com/OneAgile/_workitems/edit/36245553

Solution

  1. fix logic and add tests
  2. Add tests and improve code convention to indicate exporter is an internal class

Copilot AI review requested due to automatic review settings January 5, 2026 12:11
@nikhilNava nikhilNava requested a review from a team as a code owner January 5, 2026 12:11
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

This PR fixes initialization logic in the observability core module and prevents direct instantiation of the Agent365Exporter by marking it as an internal class. The key changes ensure that all span processors are properly added to the tracer provider and that the exporter is only accessible through the configuration API.

Key Changes:

  • Fixed initialization logic to properly add both BatchSpanProcessor and SpanProcessor to the tracer provider
  • Renamed Agent365Exporter to _Agent365Exporter with @final decorator to indicate it's internal
  • Added duplicate initialization prevention in the configure function

Reviewed changes

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

Show a summary per file
File Description
agent365_exporter.py Renamed class to _Agent365Exporter and added @final decorator to prevent inheritance and indicate internal use
__init__.py Added export control to prevent external access to the exporter (only exports Agent365ExporterOptions)
config.py Fixed initialization logic to add all processors correctly and prevent duplicate initialization; updated import to use _Agent365Exporter
test_agent365_exporter.py Updated all test references from Agent365Exporter to _Agent365Exporter; added test to verify underscore prefix convention
test_agent365.py Added comprehensive tests for initialization logic including duplicate prevention, new tracer provider creation, and existing provider usage
Comments suppressed due to low confidence (1)

libraries/microsoft-agents-a365-observability-core/microsoft_agents_a365/observability/core/exporters/agent365_exporter.py:47

  • The docstring for this class should be updated to indicate that this is an internal/private class that should not be instantiated directly by developers. Consider adding a note like "Note: This is an internal class. Use the configure() function from the observability.core module instead of instantiating this class directly."
    """
    Agent 365 span exporter for Agent 365:
      * Partitions spans by (tenantId, agentId)
      * Builds OTLP-like JSON: resourceSpans -> scopeSpans -> spans
      * POSTs per group to https://{endpoint}/maven/agent365/agents/{agentId}/traces?api-version=1
      * Adds Bearer token via token_resolver(agentId, tenantId)
    """

Copy link
Contributor

Copilot AI commented Jan 5, 2026

@nikhilNava I've opened a new pull request, #98, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Contributor

Copilot AI commented Jan 5, 2026

@nikhilNava I've opened a new pull request, #99, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 2 commits January 5, 2026 18:55
…#99)

* Initial plan

* Fix filename and add copyright header to exporters __init__.py

Co-authored-by: nikhilNava <[email protected]>

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: nikhilNava <[email protected]>
Copilot AI review requested due to automatic review settings January 5, 2026 13:44
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

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

@nikhilNava nikhilNava enabled auto-merge (squash) January 5, 2026 17:21
juliomenendez
juliomenendez previously approved these changes Jan 5, 2026
Copy link
Contributor

Copilot AI commented Jan 5, 2026

@nikhilNava I've opened a new pull request, #100, to work on those changes. Once the pull request is ready, I'll request review from you.

* Initial plan

* Remove trailing space from warning message

Co-authored-by: nikhilNava <[email protected]>

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: nikhilNava <[email protected]>
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

Copilot reviewed 9 out of 10 changed files in this pull request and generated 6 comments.

@nikhilNava nikhilNava merged commit b42d522 into main Jan 6, 2026
14 checks passed
@nikhilNava nikhilNava deleted the nikhilc/fixInitialization branch January 6, 2026 15:44
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.

5 participants