Skip to content

fix: pass provider name to interceptors instead of hardcoding it#238

Merged
ssncferreira merged 2 commits intomainfrom
ssncf/fix-interceptor-provider
Mar 31, 2026
Merged

fix: pass provider name to interceptors instead of hardcoding it#238
ssncferreira merged 2 commits intomainfrom
ssncf/fix-interceptor-provider

Conversation

@ssncferreira
Copy link
Copy Markdown
Contributor

@ssncferreira ssncferreira commented Mar 30, 2026

Problem

Interceptors hardcode the provider name for API dump and trace attributes. The chatcompletions and responses interceptors always used "openai", and the messages interceptor always used "anthropic". For Copilot, since it uses the OpenAI interceptor, this meant that requests were dumped to the openai/ directory and traced as provider=openai instead of copilot.

Changes

  • Add providerName parameter to all interceptor constructors
  • Replace hardcoded provider constants with the passed provider name in API dump and trace attributes
  • Providers pass p.Name() when constructing interceptors
  • Add Copilot API dump integration tests verifying dumps land in the correct copilot/ directory

Related to: #152

Disclaimer: initially produced by Claude Opus 4.6, heavily modified and reviewed by @ssncferreira .

Copy link
Copy Markdown
Contributor Author

ssncferreira commented Mar 30, 2026

@ssncferreira ssncferreira force-pushed the ssncf/fix-interceptor-provider branch from 4a69340 to 4027b0c Compare March 31, 2026 10:34
@ssncferreira ssncferreira force-pushed the ssncf/feat-provider-type-name branch from 2c8fad4 to 85648f5 Compare March 31, 2026 10:34
Copy link
Copy Markdown
Contributor Author

ssncferreira commented Mar 31, 2026

Merge activity

  • Mar 31, 2:32 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Mar 31, 2:34 PM UTC: Graphite rebased this pull request as part of a merge.
  • Mar 31, 2:35 PM UTC: @ssncferreira merged this pull request with Graphite.

@ssncferreira ssncferreira changed the base branch from ssncf/feat-provider-type-name to graphite-base/238 March 31, 2026 14:32
@ssncferreira ssncferreira changed the base branch from graphite-base/238 to main March 31, 2026 14:33
@ssncferreira ssncferreira force-pushed the ssncf/fix-interceptor-provider branch from 40bebf4 to 3f96e4c Compare March 31, 2026 14:34
@ssncferreira ssncferreira merged commit 97aea98 into main Mar 31, 2026
5 checks passed
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.

3 participants