Skip to content

diagnostics-otel: sanitize OTLP endpoint URL resolution (avoid false /v1 detection) #13783

@vincentkoc

Description

@vincentkoc

Problem

Current resolver treats any endpoint containing "/v1/" as a fully-qualified OTLP signal URL.
For backends like Opik (.../api/v1/private/otel), this prevents appending /v1/traces|metrics|logs, so exports go to wrong path. Discovered during testing on #12897 for #3201.

Current Behavior

  • Endpoint: https://www.comet.com/opik/api/v1/private/otel
  • Resolver sees /v1/ and returns it unchanged.
  • Trace exporter posts to /api/v1/private/otel instead of /api/v1/private/otel/v1/traces.

Expected Behavior

Base collector-like endpoints should append signal path:

  • /v1/traces
  • /v1/metrics
  • /v1/logs

Only skip append when endpoint is already signal-specific.

Proposed Fix

Replace endpoint.includes("/v1/") logic with strict path checks:

  • if endpoint path ends with /v1/traces|/v1/metrics|/v1/logs, keep as-is
  • otherwise append requested signal path

Keep trailing slash normalization.
Optionally parse with new URL() when valid; fallback to string handling for non-URL inputs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions