-
Notifications
You must be signed in to change notification settings - Fork 831
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
Add basic proxy configuration to OtlpHttp{Signal}Exporters #6270
Conversation
…pc{Signal}ExporterBuilder, remove proxy autoconfigure settings, add proxy e2e test with mock server
…y-java into proxy-options1
|
||
@Override | ||
public String toString() { | ||
return "ProxyOptions{proxySelector=" + proxySelector + "}"; |
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.
Do we know that proxySelector has a proper toString()
method?
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.
It will depend on the implementation, but the static inner SimpleProxySelector below does have a proper toString. We try to provide toString for all sdk components so that users can call OpentelemetrySdk#toString and understand the full config.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6270 +/- ##
============================================
- Coverage 91.06% 91.02% -0.04%
- Complexity 5699 5708 +9
============================================
Files 621 622 +1
Lines 16679 16709 +30
Branches 1709 1711 +2
============================================
+ Hits 15188 15210 +22
- Misses 998 1004 +6
- Partials 493 495 +2 ☔ View full report in Codecov by Sentry. |
|
||
@Override | ||
public void connectFailed(URI uri, SocketAddress sa, IOException e) { | ||
// ignore |
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.
Could it make sense to at least log out some debug logs here to indicate that there was a problem? I am not sure how common that is in the opentelemetry project to log such things though. I am not sure how verbose the client implementations are about proxy failures.
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.
FWIW, the static inner one in java.net just says /* ignore */
as well. I wonder if the user is supposed to care....
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.
The purpose of this method seems to be to allow the selector to choose another proxy for subsequent requests in the case of error, i.e. for load balancing.
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 like it. Had a couple small suggestions, but I think this proxy support will be nice for quite a few enterprise users who have forced proxies for regulatory compliance reasons.
|
||
@Override | ||
public void connectFailed(URI uri, SocketAddress sa, IOException e) { | ||
// ignore |
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.
FWIW, the static inner one in java.net just says /* ignore */
as well. I wonder if the user is supposed to care....
exporters/common/src/main/java/io/opentelemetry/exporter/internal/http/HttpExporterBuilder.java
Outdated
Show resolved
Hide resolved
assertThat(exporter.export(telemetry).join(10, TimeUnit.SECONDS).isSuccess()).isTrue(); | ||
// assert that mock server received request | ||
assertThat(clientAndServer.retrieveRecordedRequests(new org.mockserver.model.HttpRequest())) | ||
.hasSize(1); | ||
// assert that server received telemetry from proxy, and is as expected | ||
List<U> expectedResourceTelemetry = toProto(telemetry); | ||
assertThat(exportedResourceTelemetry).containsExactlyElementsOf(expectedResourceTelemetry); |
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.
If the proxy was ignored completely in the implementation (eg. setProxyOptions()
was a noop) would this test still pass? If so, is there a way to validate that the proxy was actually used, not just that the data made it across?
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.
If the proxy was ignored completely in the implementation (eg. setProxyOptions() was a noop) would this test still pass?
No the test fails. Line 683 retrieve requests recorded by the proxy and verifies it received the expected request. If the implementation fails to route through the configured proxy, the mockserver proxy will never receive the request and line 683 fails.
...ava/io/opentelemetry/exporter/otlp/testing/internal/GrpcLogRecordExporterBuilderWrapper.java
Outdated
Show resolved
Hide resolved
...n/java/io/opentelemetry/exporter/otlp/testing/internal/GrpcMetricExporterBuilderWrapper.java
Outdated
Show resolved
Hide resolved
...ain/java/io/opentelemetry/exporter/otlp/testing/internal/GrpcSpanExporterBuilderWrapper.java
Outdated
Show resolved
Hide resolved
@open-telemetry/java-approvers planning on merging this for Friday's release if there are no additional comments. |
No further open comments from my side. |
Resolves #6204. Related to #6194.
Alternative to #6206.