-
Notifications
You must be signed in to change notification settings - Fork 37
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 in OtlpHttpClient? #563
Comments
Hi. OpenTelemetry Java allows configuring proxy: https://github.com/open-telemetry/opentelemetry-java/blob/main/exporters/otlp/all/src/main/java/io/opentelemetry/exporter/otlp/http/trace/OtlpHttpSpanExporterBuilder.java#L181-L185. It would be nice to follow a similar approach in SDK, but it's impossible. AFAIK Ember does not support proxy, right? So passing a preconfigured client is the only available option. The following options are configured within the ember client builder while creating an
We configure two middlewares (retry and gzip compression), depending on the configuration. If we allow passing an external client, the timeout and TLS context settings will be ignored. |
Hi again, yes my issue comes from the Ember client not supporting any kind of proxying. After delving into the SDK codebase I've realized I was a bit too optimistic. An obvious fix would be to use http4s' JDK11+ client instead. As a side note I wish there was a way to bypass the auto-configuration entirely, essentially just pass my custom |
not yet
We cannot because the implementation must be cross-platform. jdk11 client isn't available for Scala Native and Scala.js platforms.
From what I see, the easiest option is to allow passing a custom client right to the OpenTelemetrySdk
.autoConfigured[IO](
_.addSpanExporterConfigurer(
OtlpSpanExporterAutoConfigure[IO](jdk11ClientWithProxy)
)
) However, the timeout and TLS context configurations (from env variables/props) will be ignored, so you must manually preconfigure the client. |
We should also allow passing an instance of the OtlpHttpSpanExporter.builder[IO]./*configurations*/.build.flatMap { spanExporter =>
OpenTelemetrySdk.autoConfigured[IO](_.withSpanExporter(spanExporter))
} |
And the last idea: we can add proxy configuration to the span exporter builder and dynamically choose the client. If the proxy is configured, the exporter will use the JDK11 client. On Scala Native, Scala.js, and JVM pre 11 the SDK will fail to load in this case. However, it could be tricky from the dependency management standpoint. |
I gave it a try. It may work, but there are plenty of complications, unfortunately. |
We will release these changes soon. |
Hello,
I see that the current OtlpHttpClient implementation is using a hardcoded Ember client builder.
This is an issue if you need proxy support.
Would it be possible to make the builder accept a given http4s Client?
I can probably open the PR.
The text was updated successfully, but these errors were encountered: