Skip to content

feat(otlp-exporter-base): add custom fetch option to OTLP HTTP exporters#6377

Open
zakcutner wants to merge 1 commit intoopen-telemetry:mainfrom
zakcutner:feat/custom-fetch-option
Open

feat(otlp-exporter-base): add custom fetch option to OTLP HTTP exporters#6377
zakcutner wants to merge 1 commit intoopen-telemetry:mainfrom
zakcutner:feat/custom-fetch-option

Conversation

@zakcutner
Copy link

Which problem is this PR solving?

I'm using OpenTelemetry JS in Cloudflare Workers and I need to send telemetry to a collector running in a private network via Workers VPC. Workers VPC provides a custom fetch function that can route requests through private networks, but there was no way to easily pass this to the OTLP exporters.

Before this change, the only way to achieve this was to create a custom version FetchTransport, which would require duplicating much of its implementation, or to monkey patch globalThis.fetch.

Specifying a custom fetch function could also be useful for other scenarios like adding request/response interceptors, using fetch polyfills, or testing with mocks.

Short description of the changes

Adds a fetch configuration option to OTLP HTTP exporters, allowing users to provide a custom fetch implementation instead of using globalThis.fetch.

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

  • Unit tests for configuration merging (mergeOtlpHttpConfigurationWithDefaults)
  • Unit tests for FetchTransport using custom fetch
  • Unit tests for legacy configuration converters (browser and Node.js)
  • Ran npm test (144 passing)
  • Ran npm run test:browser (85 passing)

Checklist:

  • Followed the style guidelines of this project
  • Unit tests have been added
  • Documentation has been updated

@zakcutner zakcutner requested a review from a team as a code owner February 5, 2026 23:37
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Feb 5, 2026

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: zakcutner / name: Zak Cutner (40cb2d5)

@zakcutner zakcutner force-pushed the feat/custom-fetch-option branch from 10034e0 to 4ccc217 Compare February 5, 2026 23:43
@zakcutner zakcutner force-pushed the feat/custom-fetch-option branch from 4ccc217 to 40cb2d5 Compare February 5, 2026 23:43
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.

1 participant