Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proxy support #6204

Closed
marcschumacher opened this issue Feb 7, 2024 · 5 comments · Fixed by #6270
Closed

Proxy support #6204

marcschumacher opened this issue Feb 7, 2024 · 5 comments · Fixed by #6270
Labels
Feature Request Suggest an idea for this project

Comments

@marcschumacher
Copy link
Contributor

marcschumacher commented Feb 7, 2024

Is your feature request related to a problem? Please describe.
We are working in a highly regulated environment which requires usage of a proxy to emit metrics, traces and logs. Unfortunately it is not possible to have a proxy configuration for your library, at least not for OkHttp, which explicitly requires such configuration. The JDK client might be able to pick up the common JRE properties for proxies. Still, this would not be what we need, as we explicitly only want to have OpenTelemetry traffic going through the proxy as other traffic does not require it because it is internal.

Describe the solution you'd like
We need to have additional configuration present allowing us to set the proxy host, port and type (http/https). Corresponding to the existing properties, this could be for example:

  • otel.exporter.otlp.[metrics|traces|logs].proxy.host = <proxy hostname>
  • otel.exporter.otlp.[metrics|traces|logs].proxy.port = <port number>
@marcschumacher marcschumacher added the Feature Request Suggest an idea for this project label Feb 7, 2024
@jack-berg
Copy link
Member

Defining environment variables / system properties for this type of thing needs to be defined at the spec level: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md

However, we could extend programatic configuration for these options. The trick will be figuring out how proxy config manifests in different http clients (like the jdk httpclient and okhttp clients we use) and exposing some sort of generic representation. I'm open to adding support for this if somebody wants to contribute it.

In the short term, you might consider exporting to a collector running the otlphttpexporter, which does support proxy configuration. The docs don't mention it - support was added recently and the option is sort of a "hidden option" at the moment. See this issue for more details.

@marcschumacher
Copy link
Contributor Author

I am already preparing a PR, will push it soon.

@marcschumacher
Copy link
Contributor Author

The PR is here: #6206

@ecourreges-orange
Copy link

Defining environment variables / system properties for this type of thing needs to be defined at the spec level: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md

Am I to understand that this cannot be used yet via java-instrumentation? Not until config names are chosen in the spec then implemented?
Shall I open PRs for that?
I need this functionnality, as I don't want to add code in my java apps, and my company requires a proxy to go back from GCP to OnPrem.

@jack-berg
Copy link
Member

Am I to understand that this cannot be used yet via java-instrumentation? Not until config names are chosen in the spec then implemented?

It can be used with the otel java agent, but not by setting env vars / system properties. You need to add an extension which customizes the SDK configuration to set the proxy options on the autoconfigured OTLP exporters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request Suggest an idea for this project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants