-
Notifications
You must be signed in to change notification settings - Fork 934
Refactor http, grpc senders and promote to public API #7782
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
base: main
Are you sure you want to change the base?
Conversation
|
@jack-berg, I didn't forgot this issue. I'm planning to give you a response in the week of Nov. 17. |
brunobat
left a comment
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.
@jack-berg, thanks very much for this.
The end user changes are fair enough and after updating the Quarkus code, it worked out of the box and the IT tests with a real OTel Collector pass.
I'm adding a couple of comments.
exporters/common/src/main/java/io/opentelemetry/exporter/grpc/GrpcResponse.java
Outdated
Show resolved
Hide resolved
exporters/common/src/main/java/io/opentelemetry/exporter/internal/http/HttpExporter.java
Show resolved
Hide resolved
exporters/common/src/main/java/io/opentelemetry/exporter/http/HttpSenderConfig.java
Show resolved
Hide resolved
brunobat
left a comment
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've taken a look at the declarative config being proposed. We currently don't use it but I have a few comments.
exporters/common/src/main/java/io/opentelemetry/exporter/grpc/GrpcSenderConfig.java
Show resolved
Hide resolved
exporters/common/src/main/java/io/opentelemetry/exporter/grpc/GrpcSenderConfig.java
Show resolved
Hide resolved
exporters/common/src/main/java/io/opentelemetry/exporter/grpc/GrpcSenderConfig.java
Show resolved
Hide resolved
exporters/common/src/main/java/io/opentelemetry/exporter/http/HttpSenderConfig.java
Show resolved
Hide resolved
exporters/common/src/main/java/io/opentelemetry/exporter/http/HttpSenderConfig.java
Show resolved
Hide resolved
exporters/common/src/main/java/io/opentelemetry/exporter/grpc/GrpcSenderConfig.java
Show resolved
Hide resolved
Why is this relavant for Quarkus? I'm asking because the spring starter doesn't care - and I'm trying to understand what the difference is |
There's actually nothing in here related to declarative config. The getters in As the set of configuration options we expose via the I would say that if a sender ignores any of those options, its technically not compliant. Non-compliant doesn't mean its not useful, but it does mean that the sender isn't able to behave like the user expects based on how they configured the builder. |
Because Quarkus has it's own senders based on a Vert.x client. It does not use OkHttp. See #6718 and its comments for more details. |
Thanks for the explanation @jack-berg. |
|
Ok so it seems like something close to this will work for quarkus. There are still some small tweaks (example), but its mostly correct. The next step will be to coordinate with @jkwatson and @open-telemetry/java-approvers to choose a strategy and schedule to get this merged. I opened this as one big PR to make the whole picture clear, but I'm happy to break it up in smaller more reviewable pieces as long as we can commit to work quickly to get all those pieces merged for a single release. This will be important to minimize churn. |
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.
(got through the easy 75/94 files in this first round)
...ler/src/main/java/io/opentelemetry/sdk/extension/trace/jaeger/sampler/OkHttpGrpcService.java
Outdated
Show resolved
Hide resolved
.../okhttp/src/main/java/io/opentelemetry/exporter/sender/okhttp/internal/OkHttpHttpSender.java
Outdated
Show resolved
Hide resolved
.../okhttp/src/main/java/io/opentelemetry/exporter/sender/okhttp/internal/OkHttpHttpSender.java
Outdated
Show resolved
Hide resolved
.../okhttp/src/main/java/io/opentelemetry/exporter/sender/okhttp/internal/OkHttpGrpcSender.java
Outdated
Show resolved
Hide resolved
...o/opentelemetry/exporter/sender/grpc/managedchannel/internal/UpstreamGrpcSenderProvider.java
Outdated
Show resolved
Hide resolved
...n/java/io/opentelemetry/exporter/sender/grpc/managedchannel/internal/UpstreamGrpcSender.java
Outdated
Show resolved
Hide resolved
exporters/common/src/main/java/io/opentelemetry/exporter/internal/http/HttpExporterBuilder.java
Outdated
Show resolved
Hide resolved
exporters/common/src/main/java/io/opentelemetry/exporter/internal/http/HttpExporterBuilder.java
Outdated
Show resolved
Hide resolved
exporters/common/src/main/java/io/opentelemetry/exporter/grpc/GrpcMessageWriter.java
Outdated
Show resolved
Hide resolved
exporters/common/src/main/java/io/opentelemetry/exporter/grpc/GrpcSenderConfig.java
Outdated
Show resolved
Hide resolved
|
Hi @jack-berg Any news about the split of this work into several PRs? |
|
I agreed to review this one big PR. Once @jack-berg addresses the first round of comments I'll make the next pass. |
|
Thanks for the poke @trask - will clean this up, incorporate your first round of fedback, and mark it ready for review. |
|
Ready for review. Updated the description to match the current state of things. |
trask
left a comment
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.
(just the next round)
| public abstract class ImmutableGrpcResponse implements GrpcResponse { | ||
|
|
||
| public static ImmutableGrpcResponse create( | ||
| GrpcStatusCode grpcStatusCode, @Nullable String grpcStatusDescription, byte[] responseBody) { |
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.
(just to match the accessors)
| GrpcStatusCode grpcStatusCode, @Nullable String grpcStatusDescription, byte[] responseBody) { | |
| GrpcStatusCode statusCode, @Nullable String statusDescription, byte[] responseMessage) { |
| /** Write the message to the {@link OutputStream}. */ | ||
| void writeMessage(OutputStream output) throws IOException; | ||
|
|
||
| /** Return the message length in bytes. */ |
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.
something about returning -1 in some cases?
| this.methodDescriptor = | ||
| MethodDescriptor.<MessageWriter, byte[]>newBuilder() | ||
| .setType(MethodDescriptor.MethodType.UNARY) | ||
| .setFullMethodName(serviceAndMethodName) |
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.
wdyt of renaming serviceAndMethodName everywhere to fullMethodName? (fwiw grpc defines grpc.method attribute as the full method name: https://github.com/grpc/proposal/blob/master/A66-otel-stats.md#attributes)
| @Override | ||
| public InputStream stream(SamplingStrategyParametersMarshaler value) { | ||
| return new MarshalerInputStream(value); | ||
| return new MarshalerInputStream(value.toMessageWriter(false)); |
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 worth toJsonMessageWriter to avoid the boolean flag? realize it's internal so not important (not even sure if it's a good idea)
| return new OkHttpGrpcSender( | ||
| grpcSenderConfig | ||
| .getEndpoint() | ||
| .resolve("/" + grpcSenderConfig.getServiceAndMethodName()) |
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 don't think the / should be needed
| .resolve("/" + grpcSenderConfig.getServiceAndMethodName()) | |
| .resolve(grpcSenderConfig.getServiceAndMethodName()) |
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 build was falling without it! Couldn't recreate it locally. Need to dig into it more.
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 build was falling without it! Couldn't recreate it locally. Need to dig into it more.
Resolves #6718.
Promote the HttpSender, GrpcSender interfaces to the public API. There's a lot. Summary:
Marshalerand related APIs, since they balloon the API surface area and would take lot of work to get ready for public. Introducing narrow focusedMessageWriterto serve the function currently performed byMarshaler.MarshalerServiceStuband related APIs from the gRPC senders stuff. It drags in a bunch of unnecessary cruft andio.grpc.stubdependency.HttpSenderConfig#getExportAsJson()option. Senders don't need to be burdened with understanding whether the request is binary or JSON. They just need to be told the content type and a way to write the request body.Compressorand related APIs need to get promoted as well.GrpcSenderConfig,HttpSenderConfigObject GrpcSenderConfig#getManagedChannel(), which is required for backwards compatibility and forUpstreamGrpcSender, behind an internal-onlyExtendedGrpcSenderConfig