Skip to content

fix: trace Anthropic messages behind proxy path prefixes#167

Merged
ekeith (evanmkeith) merged 1 commit into
mainfrom
06-25-fix-traceanthropic-proxy-path-matching
Jun 25, 2026
Merged

fix: trace Anthropic messages behind proxy path prefixes#167
ekeith (evanmkeith) merged 1 commit into
mainfrom
06-25-fix-traceanthropic-proxy-path-matching

Conversation

@evanmkeith

Copy link
Copy Markdown
Contributor

Summary

Fix Anthropic Go SDK tracing when the Anthropic client is configured with a proxy/base URL that adds a path prefix before /v1/messages.

traceanthropic previously matched the request path exactly against /v1/messages, so paths like /clapi/transparent/aws_bedrock/v1/messages returned nil from the router and
bypassed tracing. This updates the router to suffix-match the Anthropic Messages endpoint, matching the existing OpenAI tracing behavior for custom/proxy base URLs.

Test Plan

  • Added a regression test for a proxy-prefixed Anthropic Messages path: /clapi/transparent/aws_bedrock/v1/messages
  • Ran the focused repro test locally in a disposable copy and confirmed it fails before the fix.

  ## Summary

  Fix Anthropic Go SDK tracing when the Anthropic client is configured with a proxy/base URL that adds a path prefix before `/v1/messages`.

  `traceanthropic` previously matched the request path exactly against `/v1/messages`, so paths like `/clapi/transparent/aws_bedrock/v1/messages` returned `nil` from the router and
  bypassed tracing. This updates the router to suffix-match the Anthropic Messages endpoint, matching the existing OpenAI tracing behavior for custom/proxy base URLs.

  ## Test Plan

  - Added a regression test for a proxy-prefixed Anthropic Messages path:
    `/clapi/transparent/aws_bedrock/v1/messages`
  - Ran the focused repro test locally in a disposable copy and confirmed it fails before the fix.
@evanmkeith ekeith (evanmkeith) merged commit 1b8969e into main Jun 25, 2026
6 checks passed
@evanmkeith ekeith (evanmkeith) deleted the 06-25-fix-traceanthropic-proxy-path-matching branch June 25, 2026 21:15
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.

2 participants