Skip to content

Add proxy_address to OTLP Exporter#2167

Open
SpamapS wants to merge 1 commit into
open-telemetry:mainfrom
SpamapS:main
Open

Add proxy_address to OTLP Exporter#2167
SpamapS wants to merge 1 commit into
open-telemetry:mainfrom
SpamapS:main

Conversation

@SpamapS

@SpamapS SpamapS commented May 29, 2026

Copy link
Copy Markdown

This allows more fine-graned control over proxy configurations of various exporters.

Fixes #2166

This allows more fine-graned control over proxy configurations of various exporters.

Fixes open-telemetry#2166
@linux-foundation-easycla

Copy link
Copy Markdown

CLA Not Signed

@SpamapS

SpamapS commented May 29, 2026

Copy link
Copy Markdown
Author

I will hopefully get IBM's CLA linked to my account shortly.

@thompson-tomo thompson-tomo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion however unfortunately we are governed by the spec in terms of api design and I can't see any references to supporting proxy config there. What I would suggest is first testing the native http_proxy env variable which based on some searching should work as per below:

ENV['http_proxy'] = 'http://172.16.3.160:4226' # your http://address:port here

And if that fails, raising a spec issue to discuss adding the ability to proxy address.

Comment on lines 48 to +58
def initialize(endpoint: nil,
certificate_file: OpenTelemetry::Common::Utilities.config_opt('OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE', 'OTEL_EXPORTER_OTLP_CERTIFICATE'),
client_certificate_file: OpenTelemetry::Common::Utilities.config_opt('OTEL_EXPORTER_OTLP_TRACES_CLIENT_CERTIFICATE', 'OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE'),
client_key_file: OpenTelemetry::Common::Utilities.config_opt('OTEL_EXPORTER_OTLP_TRACES_CLIENT_KEY', 'OTEL_EXPORTER_OTLP_CLIENT_KEY'),
ssl_verify_mode: Exporter.ssl_verify_mode,
headers: OpenTelemetry::Common::Utilities.config_opt('OTEL_EXPORTER_OTLP_TRACES_HEADERS', 'OTEL_EXPORTER_OTLP_HEADERS', default: {}),
compression: OpenTelemetry::Common::Utilities.config_opt('OTEL_EXPORTER_OTLP_TRACES_COMPRESSION', 'OTEL_EXPORTER_OTLP_COMPRESSION', default: 'gzip'),
timeout: OpenTelemetry::Common::Utilities.config_opt('OTEL_EXPORTER_OTLP_TRACES_TIMEOUT', 'OTEL_EXPORTER_OTLP_TIMEOUT', default: 10),
metrics_reporter: nil)
metrics_reporter: nil,
proxy_address: OpenTelemetry::Common::Utilities.config_opt('OTEL_EXPORTER_OTLP_TRACES_PROXY_ADDRESS', 'OTEL_EXPORTER_OTLP_PROXY_ADDRESS'),
proxy_port: OpenTelemetry::Common::Utilities.config_opt('OTEL_EXPORTER_OTLP_TRACES_PROXY_PORT', 'OTEL_EXPORTER_OTLP_PROXY_PORT'))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is based on https://opentelemetry.io/docs/specs/otel/protocol/exporter/ so unfortunately I don't think it is that simple to maintain compatability with the spec.

Comment on lines +57 to +58
proxy_address: OpenTelemetry::Common::Utilities.config_opt('OTEL_EXPORTER_OTLP_TRACES_PROXY_ADDRESS', 'OTEL_EXPORTER_OTLP_PROXY_ADDRESS'),
proxy_port: OpenTelemetry::Common::Utilities.config_opt('OTEL_EXPORTER_OTLP_TRACES_PROXY_PORT', 'OTEL_EXPORTER_OTLP_PROXY_PORT'))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see either of these environment variables listed at https://opentelemetry.io/docs/specs/otel/configuration/sdk-environment-variables/

@SpamapS

SpamapS commented May 31, 2026 via email

Copy link
Copy Markdown
Author

@xuan-cao-swi

Copy link
Copy Markdown
Contributor

If you prefer not to use the implicit HTTP proxy support provided by the standard net/http library (through env http_proxy), maybe you can try to replace the @http instance variable as an alternative approach, which is similar to what python exporter supports custom sessions as an exporter parameter, the Ruby exporter does not currently support this feature (nor is it required by the OpenTelemetry specification).

e.g. hacky way
exporter = OpenTelemetry::Exporter::OTLP::Exporter.new
exporter.instance_variable_set(:@http, Net::HTTP.new(...))

@kaylareopelle

Copy link
Copy Markdown
Contributor

Hi @SpamapS, thanks for opening this PR! I wanted to check in on the CLA progress. How are things going?

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.

Feature Request: Allow setting an HTTP proxy on OTLP Exporters

4 participants