-
Notifications
You must be signed in to change notification settings - Fork 7
[SDK Parity] Add scope and domain overrides for observability pre-prod testing #107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🤖 Auto-AssignmentThis PR was automatically assigned to @threddy for review. Reason: This is a parity implementation for issue #106, which was triggered by @threddy's original PR (microsoft/Agent365-dotnet#133). Next Steps:
Automated by AI-First Polling Workflow |
Co-authored-by: sergioescalera <[email protected]>
Co-authored-by: sergioescalera <[email protected]>
libraries/microsoft-agents-a365-runtime/microsoft_agents_a365/runtime/environment_utils.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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 adds environment variable overrides for observability authentication scope and domain to enable testing against pre-production environments, maintaining SDK parity with .NET PR microsoft/Agent365-dotnet#133.
Key Changes:
- Added
A365_OBSERVABILITY_SCOPE_OVERRIDEenvironment variable to override the default authentication scope - Added
A365_OBSERVABILITY_DOMAIN_OVERRIDEenvironment variable to bypass PowerPlatformApiDiscovery and target custom endpoints - Included comprehensive test coverage for both override mechanisms
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
libraries/microsoft-agents-a365-runtime/microsoft_agents_a365/runtime/environment_utils.py |
Modified get_observability_authentication_scope() to check for scope override before returning default |
libraries/microsoft-agents-a365-observability-core/microsoft_agents_a365/observability/core/exporters/agent365_exporter.py |
Modified export() method to use domain override when present, bypassing PowerPlatformApiDiscovery |
tests/runtime/test_environment_utils.py |
Added two new tests for scope override functionality |
tests/observability/core/test_agent365_exporter.py |
Added two new tests for domain override functionality |
Comments suppressed due to low confidence (1)
libraries/microsoft-agents-a365-observability-core/microsoft_agents_a365/observability/core/exporters/agent365_exporter.py:101
- If the domain override includes a protocol prefix (e.g., "https://preprod.example.com"), the URL construction will result in malformed URLs like "https://https://preprod.example.com/...". Consider either documenting that the override should be hostname-only, or strip any protocol prefix from the override value before using it.
domain_override = os.getenv("A365_OBSERVABILITY_DOMAIN_OVERRIDE")
if domain_override:
endpoint = domain_override
else:
discovery = PowerPlatformApiDiscovery(self._cluster_category)
endpoint = discovery.get_tenant_island_cluster_endpoint(tenant_id)
endpoint_path = (
f"/maven/agent365/service/agents/{agent_id}/traces"
if self._use_s2s_endpoint
else f"/maven/agent365/agents/{agent_id}/traces"
)
url = f"https://{endpoint}{endpoint_path}?api-version=1"
libraries/microsoft-agents-a365-runtime/microsoft_agents_a365/runtime/environment_utils.py
Outdated
Show resolved
Hide resolved
...5-observability-core/microsoft_agents_a365/observability/core/exporters/agent365_exporter.py
Outdated
Show resolved
Hide resolved
...5-observability-core/microsoft_agents_a365/observability/core/exporters/agent365_exporter.py
Outdated
Show resolved
Hide resolved
libraries/microsoft-agents-a365-runtime/microsoft_agents_a365/runtime/environment_utils.py
Outdated
Show resolved
Hide resolved
...5-observability-core/microsoft_agents_a365/observability/core/exporters/agent365_exporter.py
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <[email protected]>
… env var reading Co-authored-by: sergioescalera <[email protected]>
libraries/microsoft-agents-a365-runtime/microsoft_agents_a365/runtime/environment_utils.py
Outdated
Show resolved
Hide resolved
🧹 Deployment Cleanup CompleteThe Azure Container App deployment for this PR has been cleaned up.
Thank you for contributing! 🎉 |
1 similar comment
🧹 Deployment Cleanup CompleteThe Azure Container App deployment for this PR has been cleaned up.
Thank you for contributing! 🎉 |
SDK Parity: Scope and Domain Overrides
Porting changes from .NET PR #133 to enable pre-production testing.
Implementation Plan
A365_OBSERVABILITY_SCOPE_OVERRIDEinenvironment_utils.pyget_observability_authentication_scope()to check overrideA365_OBSERVABILITY_DOMAIN_OVERRIDEinagent365_exporter.pytest_environment_utils.pytest_agent365_exporter.pyChanges Summary
Scope Override (
environment_utils.py):A365_OBSERVABILITY_SCOPE_OVERRIDEenvironment variableget_observability_authentication_scope()to check override before returning defaultDomain Override (
agent365_exporter.py):A365_OBSERVABILITY_DOMAIN_OVERRIDEenvironment variableTesting:
Security Summary
CodeQL security scan completed with 0 alerts. No security vulnerabilities introduced.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.