Skip to content

Commit

Permalink
JaegerRemoteSampler use upstream grpc implementation if ManagedChanne…
Browse files Browse the repository at this point in the history
…l is set (#5287)

* JaegerRemoteSampler only uses upstream grpc implementation if ManagedChannel is set

* Restore builder constructor
  • Loading branch information
jack-berg committed Mar 24, 2023
1 parent cbd1714 commit fa36775
Show file tree
Hide file tree
Showing 15 changed files with 183 additions and 828 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,17 @@

package io.opentelemetry.sdk.extension.trace.jaeger.sampler;

import io.grpc.ManagedChannel;
import io.opentelemetry.exporter.internal.grpc.GrpcExporterBuilder;
import io.opentelemetry.exporter.internal.grpc.MarshalerServiceStub;
import io.opentelemetry.exporter.internal.marshal.Marshaler;
import io.opentelemetry.sdk.common.CompletableResultCode;
import java.net.URI;
import java.util.function.Function;
import java.util.function.Supplier;

interface GrpcService<ReqMarshalerT extends Marshaler, ResUnMarshalerT extends UnMarshaler> {

/** Returns a new {@link GrpcExporterBuilder}. */
static <ReqMarshalerT extends Marshaler, ResUnMarshalerT extends UnMarshaler>
GrpcServiceBuilder<ReqMarshalerT, ResUnMarshalerT> builder(
String type,
long defaultTimeoutSecs,
URI defaultEndpoint,
Supplier<
Function<ManagedChannel, MarshalerServiceStub<ReqMarshalerT, ResUnMarshalerT, ?>>>
stubFactory,
String grpcServiceName,
String grpcEndpointPath) {
return GrpcServiceUtil.serviceBuilder(
type, defaultTimeoutSecs, defaultEndpoint, stubFactory, grpcServiceName, grpcEndpointPath);
}
interface GrpcService {

/**
* Exports the {@code exportRequest} which is a request {@link Marshaler} for {@code numItems}
* items.
*/
ResUnMarshalerT execute(ReqMarshalerT request, ResUnMarshalerT response);
SamplingStrategyResponseUnMarshaler execute(
SamplingStrategyParametersMarshaler request, SamplingStrategyResponseUnMarshaler response);

/** Shuts the exporter down. */
CompletableResultCode shutdown();
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,10 @@ public final class JaegerRemoteSampler implements Sampler, Closeable {

private volatile Sampler sampler;

private final GrpcService<
SamplingStrategyParametersMarshaler, SamplingStrategyResponseUnMarshaler>
delegate;
private final GrpcService delegate;

JaegerRemoteSampler(
GrpcService<SamplingStrategyParametersMarshaler, SamplingStrategyResponseUnMarshaler>
delegate,
GrpcService delegate,
@Nullable String serviceName,
int pollingIntervalMs,
Sampler initialSampler) {
Expand Down
Loading

0 comments on commit fa36775

Please sign in to comment.