-
Notifications
You must be signed in to change notification settings - Fork 848
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
Adding proxy functionality #6206
Conversation
The committers listed above are authorized under a signed CLA. |
hi @marcschumacher! can you sign the CLA above?
I'm not sure if we can support these properties before they're added to the specification: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md#configuration-options and unfortunately there's a moratorium on new env vars until the new configuration mechanism is in place |
@@ -215,6 +215,13 @@ public OtlpHttpMetricExporterBuilder setRetryPolicy(RetryPolicy retryPolicy) { | |||
return this; | |||
} | |||
|
|||
/** Sets the proxy to be used. */ | |||
public OtlpHttpMetricExporterBuilder setProxy(String proxyHost, int proxyPort) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi thanks for the contribution. The crux of this will be determine the appropriate format to expose proxy information. Given that we have strict backwards compatibility guarantees we'll be stuck supporting whatever we come up for the foreseeable future. I want to make sure that the configuration is exhaustive of what users would commonly expect, and plan on verifying this by evaluating how a number of the popular http client libraries expose proxy configuration. This will take some time to get to for me, so not realistic to get it done before the 2/9/24 release, but could be on the table for march.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sometimes forward proxies require a username and password, though much less frequently.
maybe something like setProxy(ProxyOptions)
and ProxyOptions.builder().setHost(...).setPort(...).build()
to give room for expansion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe something like setProxy(ProxyOptions) and ProxyOptions.builder().setHost(...).setPort(...).build() to give room for expansion?
Yup that's a good thought. If we determine there are say more than 2 parameters, and that the parameters are sometimes present and sometimes not, a build seems appropriate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I can file a change for this part. @jack-berg Would this give some more traction to the approval process also in terms of the discussion for being backwards compatible?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe something like setProxy(ProxyOptions) and ProxyOptions.builder().setHost(...).setPort(...).build() to give room for expansion?
@trask As setting the host and port are essential, I would rather put this as parameter in the build method than to make it some kind of optional having to call setHost and setPort optionally. Or would you rather like to have validation for this inside the builder and still not supply them using the method?
In the end it would look like ProxyOptions.builder(String host, int port).build()
, still being open for extension.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the end it would look like
ProxyOptions.builder(String host, int port).build()
, still being open for extension.
Yup, that's right. Builders which have parameters the user is required to provide accept those as initialization arguments for the builder.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have replaced the proxyHost
and proxyPort
with a new ProxyOptions
object, please check.
How can this be added to the specification? Could we make this hidden properties to already be able to make use of it until this is approved? Or is there any other way to already use such configuration?
I might be wrong, but I think the type of configuration I introduced does not apply to this moratorium, no? It says it applies to:
|
I've analyzed various http client libraries and the options they expose for configuring proxies:
One recurring pattern is to expose these options through the java ProxySelector abstract class, which produces a list of relevant Proxy for a particular URI. It combines a variety of concepts into one interface, including host, port, and the ability load balance between multiple proxies. Given that this concept is built into the JDK, and is used to build the proxy mechanisms for both HTTP client libraries we use for sender implementations, I think we should consider using it in our proxy configuration rather than trying to re-invent the wheel. Here's what I propose:
I would normally say that we should incubate this in an internal package, but don't feel that's necessary if we use @marcschumacher, @open-telemetry/java-approvers WDYT? If you agree with this direction, I can help refactor this PR. I've been working off this branch locally, including additional testing. |
@jack-berg This sounds like a great idea. Feel free to adjust my PR and let me know how I can further contribute! |
+1 yeah this sounds like a solid approach to me as well. I'm confident that users will ask for user/pass in short order, but I'm also confident that will be a nice/small/incremental add-on with the approach described above. I also think kicking the gRPC can (of worms) down the road is a good idea. |
Opened a PR to update @marcschumacher's branch here. Figured it was a significant enough set of changes that I out to give you the chance to review instead of just pushing commits to your branch. @marcschumacher if you can review / merge, its good from my perspective. |
btw, I ran across |
I ran across that too @trask. I don't think it was considered, but we should. |
@open-telemetry/java-approvers In an effort to get this change merge for upcoming release, I've opened an alternative PR #6270. Please take a look @marcschumacher. |
This PR adds functionality to enable the use of proxies with OpenTelemetry (logs, metrics and spans). It already adds the ability to configure it using