feat(otlp-exporter-base): support CONNECT proxies #5054
Closed
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?
Currently it's possible to use HTTP
CONNECT
proxies with gRPC through the@grpc/grpc-js
environment variables, however the same is not possible for the HTTP exporters.At the moment this can't be configured with environment variables, and as far as I'm aware OTel doesn't define any for proxies ? The option could be exposed with the same
HTTP(S)_PROXY
variables as gRPC but I don't know if that's desirable.I haven't updated the documentation yet in case there are any suggestions for better or additional ways to configure this.
Short description of the changes
This adds a new
proxy?: string
configuration value forOTLPExporterNodeBase
. When provided, the transport uses a customAgent
which overrides thecreateConnection
method to obtain the socket through an HTTPCONNECT
request to the proxy url.Type of change
How Has This Been Tested?
Most of the transport unit tests have been mirrored and adapted to test similar proxied scenarios.
For testing the feature in practice one can use something like https://github.com/mock-server/mockserver or any other proxy with
CONNECT
support.Checklist: