Skip to content

Add /otlp/ segment to observability exporter URL paths#229

Open
fpfp100 wants to merge 1 commit intomainfrom
users/pefan/nondwurl
Open

Add /otlp/ segment to observability exporter URL paths#229
fpfp100 wants to merge 1 commit intomainfrom
users/pefan/nondwurl

Conversation

@fpfp100
Copy link
Copy Markdown
Contributor

@fpfp100 fpfp100 commented Apr 7, 2026

Summary

  • Update Agent365Exporter to include /otlp/ in the trace export URL paths (both standard and S2S endpoints)
  • Aligns exporter routes with the OTLP endpoint naming convention: .../tenants/{tenantId}/otlp/agents/{agentId}/traces
  • Update corresponding test assertions to match the new URL format

Test plan

  • Updated existing exporter unit tests to validate new URL paths
  • Verify export succeeds against the updated service endpoints

🤖 Generated with Claude Code

Update Agent365Exporter to route traces through the OTLP-aligned endpoint
paths for both standard and S2S endpoints.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@fpfp100 fpfp100 requested a review from a team as a code owner April 7, 2026 17:58
Copilot AI review requested due to automatic review settings April 7, 2026 17:58
Copy link
Copy Markdown
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

Note

Copilot was unable to run its full agentic suite in this review.

Updates Agent365Exporter’s trace export endpoints to include an /otlp/ path segment, aligning URL routes with OTLP naming conventions and adjusting unit tests accordingly.

Changes:

  • Updated exporter trace URL construction for both standard and S2S endpoints to include /otlp/.
  • Updated unit test assertions to match the new URL format.
  • Updated option documentation to reflect the new S2S path.

Reviewed changes

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

File Description
tests/observability/core/agent365-exporter.test.ts Updates expected URL assertions to include /otlp/ segment.
packages/agents-a365-observability/src/tracing/exporter/Agent365ExporterOptions.ts Updates JSDoc for useS2SEndpoint path to include /otlp/.
packages/agents-a365-observability/src/tracing/exporter/Agent365Exporter.ts Updates endpoint path construction and class doc to include /otlp/ for trace export routes.


const urlArg = fetchCalls[0][0] as string;
expect(urlArg).toMatch(`/observabilityService/tenants/${tenantId}/agents/${agentId}/traces?api-version=1`);
expect(urlArg).toMatch(`/observabilityService/tenants/${tenantId}/otlp/agents/${agentId}/traces?api-version=1`);
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expect(...).toMatch(string) treats the string as a RegExp pattern, so the ? in traces?api-version=1 is interpreted as a regex quantifier (making the preceding character optional) rather than a literal question mark. This can make the assertions pass even when the query string is wrong. Prefer toContain(...) for substring checks, or pass a RegExp that escapes the ? (e.g., \\?).

Copilot uses AI. Check for mistakes.
expect(fetchCalls.length).toBe(1);
const urlArg = fetchCalls[0][0] as string;
expect(urlArg).toMatch(`/observabilityService/tenants/${tenantId}/agents/${agentId}/traces?api-version=1`);
expect(urlArg).toMatch(`/observabilityService/tenants/${tenantId}/otlp/agents/${agentId}/traces?api-version=1`);
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expect(...).toMatch(string) treats the string as a RegExp pattern, so the ? in traces?api-version=1 is interpreted as a regex quantifier (making the preceding character optional) rather than a literal question mark. This can make the assertions pass even when the query string is wrong. Prefer toContain(...) for substring checks, or pass a RegExp that escapes the ? (e.g., \\?).

Copilot uses AI. Check for mistakes.
Comment on lines 172 to +176
// Select endpoint path based on S2S flag (includes tenantId in path)
const endpointRelativePath =
this.options.useS2SEndpoint
? `/observabilityService/tenants/${encodeURIComponent(tenantId)}/agents/${encodeURIComponent(agentId)}/traces`
: `/observability/tenants/${encodeURIComponent(tenantId)}/agents/${encodeURIComponent(agentId)}/traces`;
? `/observabilityService/tenants/${encodeURIComponent(tenantId)}/otlp/agents/${encodeURIComponent(agentId)}/traces`
: `/observability/tenants/${encodeURIComponent(tenantId)}/otlp/agents/${encodeURIComponent(agentId)}/traces`;
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The two path templates are nearly identical and differ only by the service prefix (/observabilityService vs /observability). Consider extracting a small helper (or building the prefix separately) to reduce duplication and make future path changes less error-prone.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

@nikhilNava nikhilNava left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add example of this working with DW scenario?

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.

4 participants