Use Agent365ExporterOptions for exporter and create AgenticTokenCache… - #46
Merged
Conversation
PengF (fpfp100)
marked this pull request as ready for review
November 11, 2025 00:09
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the Agent365 exporter to use an options pattern and introduces a token caching mechanism for improved flexibility and maintainability.
Key Changes:
- Introduced
Agent365ExporterOptionsclass to encapsulate exporter configuration - Created
AgenticTokenCacheutility for caching authentication tokens with TTL support - Modified
Agent365Exporterconstructor to maketokenResolveroptional, falling back to the cache when not provided - Improved type safety by replacing
anytypes withunknownin OTLP interfaces
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
packages/agents-a365-observability/src/utils/AgenticTokenCache.ts |
New utility class implementing an in-memory TTL-based token cache with get/set operations and cache key generation |
packages/agents-a365-observability/src/tracing/exporter/Agent365ExporterOptions.ts |
New configuration class defining exporter options including cluster category, token resolver, and batch processing parameters |
packages/agents-a365-observability/src/tracing/exporter/Agent365Exporter.ts |
Refactored to use options pattern, made tokenResolver optional with AgenticTokenCache fallback, improved type safety with unknown instead of any |
packages/agents-a365-observability/src/ObservabilityBuilder.ts |
Removed validation requiring tokenResolver, allowing fallback to cache-based resolution |
tests/observability/core/agent365-exporter.test.ts |
New test suite covering exporter functionality with custom and cache-based token resolution |
Julio Carlos Menendez (juliomenendez)
previously approved these changes
Nov 14, 2025
Julio Carlos Menendez (juliomenendez)
requested changes
Nov 19, 2025
Julio Carlos Menendez (juliomenendez)
left a comment
There was a problem hiding this comment.
Can we lower case the folder name? tokenCache should be tokencache. Same with observabilityBuilder-options.test.ts, let's Not mix naming conventions.
Nikhil Navakiran (nikhilNava)
approved these changes
Nov 19, 2025
Julio Carlos Menendez (juliomenendez)
approved these changes
Nov 19, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Typical usage pattern for AgenticTokenCache:
(1) Add the RefreshObservabilityToken method in activity handler (non-blocking for rest of logic):
(2) Later the exporter will try to retrieve the token from the cache. If the token is not returned, an error will be logger.

AgenticTokenCache will not be used if Custom token resolver is configured.