feat(otlp-exporter-base): add custom fetch option to OTLP HTTP exporters#6377
Open
zakcutner wants to merge 1 commit intoopen-telemetry:mainfrom
Open
feat(otlp-exporter-base): add custom fetch option to OTLP HTTP exporters#6377zakcutner wants to merge 1 commit intoopen-telemetry:mainfrom
zakcutner wants to merge 1 commit intoopen-telemetry:mainfrom
Conversation
|
|
10034e0 to
4ccc217
Compare
4ccc217 to
40cb2d5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
fetchfunction 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 patchglobalThis.fetch.Specifying a custom
fetchfunction 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
fetchconfiguration option to OTLP HTTP exporters, allowing users to provide a customfetchimplementation instead of usingglobalThis.fetch.Type of change
How Has This Been Tested?
mergeOtlpHttpConfigurationWithDefaults)FetchTransportusing custom fetchnpm test(144 passing)npm run test:browser(85 passing)Checklist: