Add A365 S2S exporter sample#217
Open
nikhilNava wants to merge 1 commit into
Open
Conversation
Add a self-contained sample under samples/a365_s2s/ demonstrating A365 telemetry export using the S2S (service-to-service) flow: - Custom a365_token_resolver mirroring the SDK FIC flow (app -> instance token exchange via MSAL) minus the agentic-user step, plus a365_use_s2s_endpoint=True. - Manual A365 scope classes (InvokeAgent/Inference/ExecuteTool), so the sample needs no LLM. - uv-managed project (pyproject.toml), .env via python-dotenv, and DEBUG logging so developers can see the export HTTP status and correlation id. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Performance comparisonThreshold: regressions >15.0% on gating scenarios fail the build. Higher ops/s is better; positive Δ means the PR is slower.
|
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new self-contained sample under samples/a365_s2s/ that demonstrates exporting Agent 365 (A365) telemetry via the service-to-service (S2S) authentication flow, including a custom MSAL-based token resolver and manual scope instrumentation.
Changes:
- Introduces an S2S sample script that configures the A365 exporter for the S2S ingest endpoint and emits representative spans using manual A365 scope classes.
- Adds sample documentation +
.envtemplate describing required credentials, runtime toggles, and expected DEBUG exporter output. - Adds an
uv-managed sample project (with lockfile) to make the sample runnable without manual venv setup.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| samples/a365_s2s/s2s_exporter.py | Implements the S2S token resolver and a runnable manual-telemetry scenario configured for the S2S exporter endpoint. |
| samples/a365_s2s/README.md | Documents prerequisites, setup, execution, and required environment variables for the S2S scenario. |
| samples/a365_s2s/pyproject.toml | Defines a small uv project with runtime dependencies for the sample. |
| samples/a365_s2s/.env.example | Provides a template for required env vars and exporter toggles. |
| samples/a365_s2s/uv.lock | Locks the sample’s dependency set for reproducible installs via uv. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+213
to
+216
| def main(): | ||
| # Load configuration from a local .env file (see .env.example). Real | ||
| # environment variables take precedence over the .env file (dotenv default). | ||
| load_dotenv() |
Comment on lines
+133
to
+137
| def resolve(agent_id: str, request_tenant_id: str) -> Optional[str]: | ||
| # The resolver runs on the exporter's worker thread; guard the cache to | ||
| # keep token acquisition thread-safe. | ||
| cache_key = f"{request_tenant_id}:{agent_id}" | ||
|
|
Comment on lines
+204
to
+211
| handler = logging.StreamHandler() | ||
| handler.setFormatter(logging.Formatter("%(levelname)s %(name)s: %(message)s")) | ||
| exporter_logger = logging.getLogger( | ||
| "microsoft.opentelemetry.a365.core.exporters.agent365_exporter" | ||
| ) | ||
| exporter_logger.setLevel(logging.DEBUG) | ||
| exporter_logger.addHandler(handler) | ||
|
|
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.
What
Adds a self-contained sample under
samples/a365_s2s/demonstrating how to export Agent 365 (A365) telemetry using the S2S (service-to-service) flow.Why
The existing
samples/a365samples cover the AI-teammate flow (with an agentic user). This adds the missing S2S scenario, where a service authenticates on its own behalf using its app-registration credentials — there is no agentic user.What's in it
_create_fic_token_resolver(app -> instance token exchange via MSAL), excluding the agentic-user (user_fic) step, combined witha365_use_s2s_endpoint=True.pyproject.toml),.envviapython-dotenv(with.env.example), and a placeholder/empty-value guard with friendly errors.HTTP 200 success ... Correlation ID: <id> ... "status":"sent".Testing
Verified end-to-end against the live S2S endpoint: token acquired and HTTP 200 with all sinks reporting
sent. The placeholder guard and missing-credential paths were also exercised.