mirror of
https://github.com/fumiama/terasu-cloudflared.git
synced 2026-06-08 03:55:11 +08:00
TUN-528: Move cloudflared into a separate repo
This commit is contained in:
38
vendor/github.com/grpc-ecosystem/grpc-opentracing/java/src/main/java/io/opentracing/contrib/ActiveSpanSource.java
generated
vendored
Normal file
38
vendor/github.com/grpc-ecosystem/grpc-opentracing/java/src/main/java/io/opentracing/contrib/ActiveSpanSource.java
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
package io.opentracing.contrib;
|
||||
|
||||
import io.opentracing.Span;
|
||||
import io.opentracing.contrib.OpenTracingContextKey;
|
||||
|
||||
/**
|
||||
* An interface that defines how to get the current active span
|
||||
*/
|
||||
public interface ActiveSpanSource {
|
||||
|
||||
/**
|
||||
* ActiveSpanSource implementation that always returns
|
||||
* null as the active span
|
||||
*/
|
||||
public static ActiveSpanSource NONE = new ActiveSpanSource() {
|
||||
@Override
|
||||
public Span getActiveSpan() {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* ActiveSpanSource implementation that returns the
|
||||
* current span stored in the GRPC context under
|
||||
* {@link OpenTracingContextKey}
|
||||
*/
|
||||
public static ActiveSpanSource GRPC_CONTEXT = new ActiveSpanSource() {
|
||||
@Override
|
||||
public Span getActiveSpan() {
|
||||
return OpenTracingContextKey.activeSpan();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @return the active span
|
||||
*/
|
||||
public Span getActiveSpan();
|
||||
}
|
||||
292
vendor/github.com/grpc-ecosystem/grpc-opentracing/java/src/main/java/io/opentracing/contrib/ClientTracingInterceptor.java
generated
vendored
Normal file
292
vendor/github.com/grpc-ecosystem/grpc-opentracing/java/src/main/java/io/opentracing/contrib/ClientTracingInterceptor.java
generated
vendored
Normal file
@@ -0,0 +1,292 @@
|
||||
package io.opentracing.contrib;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import io.grpc.*;
|
||||
import io.opentracing.Span;
|
||||
import io.opentracing.Tracer;
|
||||
import io.opentracing.propagation.Format;
|
||||
import io.opentracing.propagation.TextMap;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* An intercepter that applies tracing via OpenTracing to all client requests.
|
||||
*/
|
||||
public class ClientTracingInterceptor implements ClientInterceptor {
|
||||
|
||||
private final Tracer tracer;
|
||||
private final OperationNameConstructor operationNameConstructor;
|
||||
private final boolean streaming;
|
||||
private final boolean verbose;
|
||||
private final Set<ClientRequestAttribute> tracedAttributes;
|
||||
private final ActiveSpanSource activeSpanSource;
|
||||
|
||||
/**
|
||||
* @param tracer to use to trace requests
|
||||
*/
|
||||
public ClientTracingInterceptor(Tracer tracer) {
|
||||
this.tracer = tracer;
|
||||
this.operationNameConstructor = OperationNameConstructor.DEFAULT;
|
||||
this.streaming = false;
|
||||
this.verbose = false;
|
||||
this.tracedAttributes = new HashSet<ClientRequestAttribute>();
|
||||
this.activeSpanSource = ActiveSpanSource.GRPC_CONTEXT;
|
||||
}
|
||||
|
||||
private ClientTracingInterceptor(Tracer tracer, OperationNameConstructor operationNameConstructor, boolean streaming,
|
||||
boolean verbose, Set<ClientRequestAttribute> tracedAttributes, ActiveSpanSource activeSpanSource) {
|
||||
this.tracer = tracer;
|
||||
this.operationNameConstructor = operationNameConstructor;
|
||||
this.streaming = streaming;
|
||||
this.verbose = verbose;
|
||||
this.tracedAttributes = tracedAttributes;
|
||||
this.activeSpanSource = activeSpanSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this intercepter to trace all requests made by this client channel.
|
||||
* @param channel to be traced
|
||||
* @return intercepted channel
|
||||
*/
|
||||
public Channel intercept(Channel channel) {
|
||||
return ClientInterceptors.intercept(channel, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <ReqT, RespT> ClientCall<ReqT, RespT> interceptCall(
|
||||
MethodDescriptor<ReqT, RespT> method,
|
||||
CallOptions callOptions,
|
||||
Channel next
|
||||
) {
|
||||
final String operationName = operationNameConstructor.constructOperationName(method);
|
||||
|
||||
Span activeSpan = this.activeSpanSource.getActiveSpan();
|
||||
final Span span = createSpanFromParent(activeSpan, operationName);
|
||||
|
||||
for (ClientRequestAttribute attr : this.tracedAttributes) {
|
||||
switch (attr) {
|
||||
case ALL_CALL_OPTIONS:
|
||||
span.setTag("grpc.call_options", callOptions.toString());
|
||||
break;
|
||||
case AUTHORITY:
|
||||
if (callOptions.getAuthority() == null) {
|
||||
span.setTag("grpc.authority", "null");
|
||||
} else {
|
||||
span.setTag("grpc.authority", callOptions.getAuthority());
|
||||
}
|
||||
break;
|
||||
case COMPRESSOR:
|
||||
if (callOptions.getCompressor() == null) {
|
||||
span.setTag("grpc.compressor", "null");
|
||||
} else {
|
||||
span.setTag("grpc.compressor", callOptions.getCompressor());
|
||||
}
|
||||
break;
|
||||
case DEADLINE:
|
||||
if (callOptions.getDeadline() == null) {
|
||||
span.setTag("grpc.deadline_millis", "null");
|
||||
} else {
|
||||
span.setTag("grpc.deadline_millis", callOptions.getDeadline().timeRemaining(TimeUnit.MILLISECONDS));
|
||||
}
|
||||
break;
|
||||
case METHOD_NAME:
|
||||
span.setTag("grpc.method_name", method.getFullMethodName());
|
||||
break;
|
||||
case METHOD_TYPE:
|
||||
if (method.getType() == null) {
|
||||
span.setTag("grpc.method_type", "null");
|
||||
} else {
|
||||
span.setTag("grpc.method_type", method.getType().toString());
|
||||
}
|
||||
break;
|
||||
case HEADERS:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return new ForwardingClientCall.SimpleForwardingClientCall<ReqT, RespT>(next.newCall(method, callOptions)) {
|
||||
|
||||
@Override
|
||||
public void start(Listener<RespT> responseListener, Metadata headers) {
|
||||
if (verbose) {
|
||||
span.log("Started call");
|
||||
}
|
||||
if (tracedAttributes.contains(ClientRequestAttribute.HEADERS)) {
|
||||
span.setTag("grpc.headers", headers.toString());
|
||||
}
|
||||
|
||||
tracer.inject(span.context(), Format.Builtin.HTTP_HEADERS, new TextMap() {
|
||||
@Override
|
||||
public void put(String key, String value) {
|
||||
Metadata.Key<String> headerKey = Metadata.Key.of(key, Metadata.ASCII_STRING_MARSHALLER);
|
||||
headers.put(headerKey, value);
|
||||
}
|
||||
@Override
|
||||
public Iterator<Entry<String, String>> iterator() {
|
||||
throw new UnsupportedOperationException(
|
||||
"TextMapInjectAdapter should only be used with Tracer.inject()");
|
||||
}
|
||||
});
|
||||
|
||||
Listener<RespT> tracingResponseListener = new ForwardingClientCallListener
|
||||
.SimpleForwardingClientCallListener<RespT>(responseListener) {
|
||||
|
||||
@Override
|
||||
public void onHeaders(Metadata headers) {
|
||||
if (verbose) { span.log(ImmutableMap.of("Response headers received", headers.toString())); }
|
||||
delegate().onHeaders(headers);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessage(RespT message) {
|
||||
if (streaming || verbose) { span.log("Response received"); }
|
||||
delegate().onMessage(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClose(Status status, Metadata trailers) {
|
||||
if (verbose) {
|
||||
if (status.getCode().value() == 0) { span.log("Call closed"); }
|
||||
else { span.log(ImmutableMap.of("Call failed", status.getDescription())); }
|
||||
}
|
||||
span.finish();
|
||||
delegate().onClose(status, trailers);
|
||||
}
|
||||
};
|
||||
delegate().start(tracingResponseListener, headers);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancel(@Nullable String message, @Nullable Throwable cause) {
|
||||
String errorMessage;
|
||||
if (message == null) {
|
||||
errorMessage = "Error";
|
||||
} else {
|
||||
errorMessage = message;
|
||||
}
|
||||
if (cause == null) {
|
||||
span.log(errorMessage);
|
||||
} else {
|
||||
span.log(ImmutableMap.of(errorMessage, cause.getMessage()));
|
||||
}
|
||||
delegate().cancel(message, cause);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void halfClose() {
|
||||
if (streaming) { span.log("Finished sending messages"); }
|
||||
delegate().halfClose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMessage(ReqT message) {
|
||||
if (streaming || verbose) { span.log("Message sent"); }
|
||||
delegate().sendMessage(message);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private Span createSpanFromParent(Span parentSpan, String operationName) {
|
||||
if (parentSpan == null) {
|
||||
return tracer.buildSpan(operationName).startManual();
|
||||
} else {
|
||||
return tracer.buildSpan(operationName).asChildOf(parentSpan).startManual();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the configuration of a ClientTracingInterceptor.
|
||||
*/
|
||||
public static class Builder {
|
||||
|
||||
private Tracer tracer;
|
||||
private OperationNameConstructor operationNameConstructor;
|
||||
private boolean streaming;
|
||||
private boolean verbose;
|
||||
private Set<ClientRequestAttribute> tracedAttributes;
|
||||
private ActiveSpanSource activeSpanSource;
|
||||
|
||||
/**
|
||||
* @param tracer to use for this intercepter
|
||||
* Creates a Builder with default configuration
|
||||
*/
|
||||
public Builder(Tracer tracer) {
|
||||
this.tracer = tracer;
|
||||
this.operationNameConstructor = OperationNameConstructor.DEFAULT;
|
||||
this.streaming = false;
|
||||
this.verbose = false;
|
||||
this.tracedAttributes = new HashSet<ClientRequestAttribute>();
|
||||
this.activeSpanSource = ActiveSpanSource.GRPC_CONTEXT;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param operationNameConstructor to name all spans created by this intercepter
|
||||
* @return this Builder with configured operation name
|
||||
*/
|
||||
public Builder withOperationName(OperationNameConstructor operationNameConstructor) {
|
||||
this.operationNameConstructor = operationNameConstructor;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs streaming events to client spans.
|
||||
* @return this Builder configured to log streaming events
|
||||
*/
|
||||
public Builder withStreaming() {
|
||||
this.streaming = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param tracedAttributes to set as tags on client spans
|
||||
* created by this intercepter
|
||||
* @return this Builder configured to trace attributes
|
||||
*/
|
||||
public Builder withTracedAttributes(ClientRequestAttribute... tracedAttributes) {
|
||||
this.tracedAttributes = new HashSet<ClientRequestAttribute>(
|
||||
Arrays.asList(tracedAttributes));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs all request life-cycle events to client spans.
|
||||
* @return this Builder configured to be verbose
|
||||
*/
|
||||
public Builder withVerbosity() {
|
||||
this.verbose = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param activeSpanSource that provides a method of getting the
|
||||
* active span before the client call
|
||||
* @return this Builder configured to start client span as children
|
||||
* of the span returned by activeSpanSource.getActiveSpan()
|
||||
*/
|
||||
public Builder withActiveSpanSource(ActiveSpanSource activeSpanSource) {
|
||||
this.activeSpanSource = activeSpanSource;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a ClientTracingInterceptor with this Builder's configuration
|
||||
*/
|
||||
public ClientTracingInterceptor build() {
|
||||
return new ClientTracingInterceptor(this.tracer, this.operationNameConstructor,
|
||||
this.streaming, this.verbose, this.tracedAttributes, this.activeSpanSource);
|
||||
}
|
||||
}
|
||||
|
||||
public enum ClientRequestAttribute {
|
||||
METHOD_TYPE,
|
||||
METHOD_NAME,
|
||||
DEADLINE,
|
||||
COMPRESSOR,
|
||||
AUTHORITY,
|
||||
ALL_CALL_OPTIONS,
|
||||
HEADERS
|
||||
}
|
||||
}
|
||||
31
vendor/github.com/grpc-ecosystem/grpc-opentracing/java/src/main/java/io/opentracing/contrib/OpenTracingContextKey.java
generated
vendored
Normal file
31
vendor/github.com/grpc-ecosystem/grpc-opentracing/java/src/main/java/io/opentracing/contrib/OpenTracingContextKey.java
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
package io.opentracing.contrib;
|
||||
|
||||
import io.grpc.Context;
|
||||
|
||||
import io.opentracing.Span;
|
||||
|
||||
/**
|
||||
* A {@link io.grpc.Context} key for the current OpenTracing trace state.
|
||||
*
|
||||
* Can be used to get the active span, or to set the active span for a scoped unit of work.
|
||||
* See the <a href="../../../../../../README.rst">grpc-java OpenTracing docs</a> for use cases and examples.
|
||||
*/
|
||||
public class OpenTracingContextKey {
|
||||
|
||||
public static final String KEY_NAME = "io.opentracing.active-span";
|
||||
private static final Context.Key<Span> key = Context.key(KEY_NAME);
|
||||
|
||||
/**
|
||||
* @return the active span for the current request
|
||||
*/
|
||||
public static Span activeSpan() {
|
||||
return key.get();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the OpenTracing context key
|
||||
*/
|
||||
public static Context.Key<Span> getKey() {
|
||||
return key;
|
||||
}
|
||||
}
|
||||
30
vendor/github.com/grpc-ecosystem/grpc-opentracing/java/src/main/java/io/opentracing/contrib/OperationNameConstructor.java
generated
vendored
Normal file
30
vendor/github.com/grpc-ecosystem/grpc-opentracing/java/src/main/java/io/opentracing/contrib/OperationNameConstructor.java
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
package io.opentracing.contrib;
|
||||
|
||||
import io.grpc.MethodDescriptor;
|
||||
|
||||
/**
|
||||
* Interface that allows span operation names to be constructed from an RPC's
|
||||
* method descriptor.
|
||||
*/
|
||||
public interface OperationNameConstructor {
|
||||
|
||||
/**
|
||||
* Default span operation name constructor, that will return an RPC's method
|
||||
* name when constructOperationName is called.
|
||||
*/
|
||||
public static OperationNameConstructor DEFAULT = new OperationNameConstructor() {
|
||||
@Override
|
||||
public <ReqT, RespT> String constructOperationName(MethodDescriptor<ReqT, RespT> method) {
|
||||
return method.getFullMethodName();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructs a span's operation name from the RPC's method.
|
||||
* @param method the rpc method to extract a name from
|
||||
* @param <ReqT> the rpc request type
|
||||
* @param <RespT> the rpc response type
|
||||
* @return the operation name
|
||||
*/
|
||||
public <ReqT, RespT> String constructOperationName(MethodDescriptor<ReqT, RespT> method);
|
||||
}
|
||||
241
vendor/github.com/grpc-ecosystem/grpc-opentracing/java/src/main/java/io/opentracing/contrib/ServerTracingInterceptor.java
generated
vendored
Normal file
241
vendor/github.com/grpc-ecosystem/grpc-opentracing/java/src/main/java/io/opentracing/contrib/ServerTracingInterceptor.java
generated
vendored
Normal file
@@ -0,0 +1,241 @@
|
||||
package io.opentracing.contrib;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import io.grpc.BindableService;
|
||||
import io.grpc.Context;
|
||||
import io.grpc.Contexts;
|
||||
import io.grpc.Metadata;
|
||||
import io.grpc.ServerCall;
|
||||
import io.grpc.ServerCallHandler;
|
||||
import io.grpc.ServerInterceptor;
|
||||
import io.grpc.ServerInterceptors;
|
||||
import io.grpc.ServerServiceDefinition;
|
||||
import io.grpc.ForwardingServerCallListener;
|
||||
|
||||
import io.opentracing.propagation.Format;
|
||||
import io.opentracing.propagation.TextMapExtractAdapter;
|
||||
import io.opentracing.Span;
|
||||
import io.opentracing.SpanContext;
|
||||
import io.opentracing.Tracer;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* An intercepter that applies tracing via OpenTracing to all requests
|
||||
* to the server.
|
||||
*/
|
||||
public class ServerTracingInterceptor implements ServerInterceptor {
|
||||
|
||||
private final Tracer tracer;
|
||||
private final OperationNameConstructor operationNameConstructor;
|
||||
private final boolean streaming;
|
||||
private final boolean verbose;
|
||||
private final Set<ServerRequestAttribute> tracedAttributes;
|
||||
|
||||
/**
|
||||
* @param tracer used to trace requests
|
||||
*/
|
||||
public ServerTracingInterceptor(Tracer tracer) {
|
||||
this.tracer = tracer;
|
||||
this.operationNameConstructor = OperationNameConstructor.DEFAULT;
|
||||
this.streaming = false;
|
||||
this.verbose = false;
|
||||
this.tracedAttributes = new HashSet<ServerRequestAttribute>();
|
||||
}
|
||||
|
||||
private ServerTracingInterceptor(Tracer tracer, OperationNameConstructor operationNameConstructor, boolean streaming,
|
||||
boolean verbose, Set<ServerRequestAttribute> tracedAttributes) {
|
||||
this.tracer = tracer;
|
||||
this.operationNameConstructor = operationNameConstructor;
|
||||
this.streaming = streaming;
|
||||
this.verbose = verbose;
|
||||
this.tracedAttributes = tracedAttributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add tracing to all requests made to this service.
|
||||
* @param serviceDef of the service to intercept
|
||||
* @return the serviceDef with a tracing interceptor
|
||||
*/
|
||||
public ServerServiceDefinition intercept(ServerServiceDefinition serviceDef) {
|
||||
return ServerInterceptors.intercept(serviceDef, this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add tracing to all requests made to this service.
|
||||
* @param bindableService to intercept
|
||||
* @return the serviceDef with a tracing interceptor
|
||||
*/
|
||||
public ServerServiceDefinition intercept(BindableService bindableService) {
|
||||
return ServerInterceptors.intercept(bindableService, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <ReqT, RespT> ServerCall.Listener<ReqT> interceptCall(
|
||||
ServerCall<ReqT, RespT> call,
|
||||
Metadata headers,
|
||||
ServerCallHandler<ReqT, RespT> next
|
||||
) {
|
||||
Map<String, String> headerMap = new HashMap<String, String>();
|
||||
for (String key : headers.keys()) {
|
||||
if (!key.endsWith(Metadata.BINARY_HEADER_SUFFIX)) {
|
||||
String value = headers.get(Metadata.Key.of(key, Metadata.ASCII_STRING_MARSHALLER));
|
||||
headerMap.put(key, value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
final String operationName = operationNameConstructor.constructOperationName(call.getMethodDescriptor());
|
||||
final Span span = getSpanFromHeaders(headerMap, operationName);
|
||||
|
||||
for (ServerRequestAttribute attr : this.tracedAttributes) {
|
||||
switch (attr) {
|
||||
case METHOD_TYPE:
|
||||
span.setTag("grpc.method_type", call.getMethodDescriptor().getType().toString());
|
||||
break;
|
||||
case METHOD_NAME:
|
||||
span.setTag("grpc.method_name", call.getMethodDescriptor().getFullMethodName());
|
||||
break;
|
||||
case CALL_ATTRIBUTES:
|
||||
span.setTag("grpc.call_attributes", call.getAttributes().toString());
|
||||
break;
|
||||
case HEADERS:
|
||||
span.setTag("grpc.headers", headers.toString());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Context ctxWithSpan = Context.current().withValue(OpenTracingContextKey.getKey(), span);
|
||||
ServerCall.Listener<ReqT> listenerWithContext = Contexts
|
||||
.interceptCall(ctxWithSpan, call, headers, next);
|
||||
|
||||
ServerCall.Listener<ReqT> tracingListenerWithContext =
|
||||
new ForwardingServerCallListener.SimpleForwardingServerCallListener<ReqT>(listenerWithContext) {
|
||||
|
||||
@Override
|
||||
public void onMessage(ReqT message) {
|
||||
if (streaming || verbose) { span.log(ImmutableMap.of("Message received", message)); }
|
||||
delegate().onMessage(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHalfClose() {
|
||||
if (streaming) { span.log("Client finished sending messages"); }
|
||||
delegate().onHalfClose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel() {
|
||||
span.log("Call cancelled");
|
||||
span.finish();
|
||||
delegate().onCancel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
if (verbose) { span.log("Call completed"); }
|
||||
span.finish();
|
||||
delegate().onComplete();
|
||||
}
|
||||
};
|
||||
|
||||
return tracingListenerWithContext;
|
||||
}
|
||||
|
||||
private Span getSpanFromHeaders(Map<String, String> headers, String operationName) {
|
||||
Span span;
|
||||
try {
|
||||
SpanContext parentSpanCtx = tracer.extract(Format.Builtin.HTTP_HEADERS,
|
||||
new TextMapExtractAdapter(headers));
|
||||
if (parentSpanCtx == null) {
|
||||
span = tracer.buildSpan(operationName).startManual();
|
||||
} else {
|
||||
span = tracer.buildSpan(operationName).asChildOf(parentSpanCtx).startManual();
|
||||
}
|
||||
} catch (IllegalArgumentException iae){
|
||||
span = tracer.buildSpan(operationName)
|
||||
.withTag("Error", "Extract failed and an IllegalArgumentException was thrown")
|
||||
.startManual();
|
||||
}
|
||||
return span;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the configuration of a ServerTracingInterceptor.
|
||||
*/
|
||||
public static class Builder {
|
||||
private final Tracer tracer;
|
||||
private OperationNameConstructor operationNameConstructor;
|
||||
private boolean streaming;
|
||||
private boolean verbose;
|
||||
private Set<ServerRequestAttribute> tracedAttributes;
|
||||
|
||||
/**
|
||||
* @param tracer to use for this intercepter
|
||||
* Creates a Builder with default configuration
|
||||
*/
|
||||
public Builder(Tracer tracer) {
|
||||
this.tracer = tracer;
|
||||
this.operationNameConstructor = OperationNameConstructor.DEFAULT;
|
||||
this.streaming = false;
|
||||
this.verbose = false;
|
||||
this.tracedAttributes = new HashSet<ServerRequestAttribute>();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param operationNameConstructor for all spans created by this intercepter
|
||||
* @return this Builder with configured operation name
|
||||
*/
|
||||
public Builder withOperationName(OperationNameConstructor operationNameConstructor) {
|
||||
this.operationNameConstructor = operationNameConstructor;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param attributes to set as tags on server spans
|
||||
* created by this intercepter
|
||||
* @return this Builder configured to trace request attributes
|
||||
*/
|
||||
public Builder withTracedAttributes(ServerRequestAttribute... attributes) {
|
||||
this.tracedAttributes = new HashSet<ServerRequestAttribute>(Arrays.asList(attributes));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs streaming events to server spans.
|
||||
* @return this Builder configured to log streaming events
|
||||
*/
|
||||
public Builder withStreaming() {
|
||||
this.streaming = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs all request life-cycle events to server spans.
|
||||
* @return this Builder configured to be verbose
|
||||
*/
|
||||
public Builder withVerbosity() {
|
||||
this.verbose = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a ServerTracingInterceptor with this Builder's configuration
|
||||
*/
|
||||
public ServerTracingInterceptor build() {
|
||||
return new ServerTracingInterceptor(this.tracer, this.operationNameConstructor,
|
||||
this.streaming, this.verbose, this.tracedAttributes);
|
||||
}
|
||||
}
|
||||
|
||||
public enum ServerRequestAttribute {
|
||||
HEADERS,
|
||||
METHOD_TYPE,
|
||||
METHOD_NAME,
|
||||
CALL_ATTRIBUTES
|
||||
}
|
||||
}
|
||||
48
vendor/github.com/grpc-ecosystem/grpc-opentracing/java/src/test/java/io/opentracing/contrib/ActiveSpanSourceTest.java
generated
vendored
Normal file
48
vendor/github.com/grpc-ecosystem/grpc-opentracing/java/src/test/java/io/opentracing/contrib/ActiveSpanSourceTest.java
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
package io.opentracing.contrib;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import io.grpc.Context;
|
||||
import io.opentracing.Span;
|
||||
import io.opentracing.Tracer;
|
||||
import io.opentracing.mock.MockTracer;
|
||||
|
||||
public class ActiveSpanSourceTest {
|
||||
|
||||
Tracer tracer = new MockTracer();
|
||||
|
||||
@Test
|
||||
public void TestDefaultNone() {
|
||||
ActiveSpanSource ss = ActiveSpanSource.NONE;
|
||||
assertEquals("active span should always be null", ss.getActiveSpan(), null);
|
||||
|
||||
Span span = tracer.buildSpan("s0").start();
|
||||
Context ctx = Context.current().withValue(OpenTracingContextKey.getKey(), span);
|
||||
Context previousCtx = ctx.attach();
|
||||
|
||||
assertEquals("active span should always be null", ss.getActiveSpan(), null);
|
||||
|
||||
ctx.detach(previousCtx);
|
||||
span.finish();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TestDefaultGrpc() {
|
||||
ActiveSpanSource ss = ActiveSpanSource.GRPC_CONTEXT;
|
||||
assertEquals("active span should be null, no span in OpenTracingContextKey", ss.getActiveSpan(), null);
|
||||
|
||||
Span span = tracer.buildSpan("s0").start();
|
||||
Context ctx = Context.current().withValue(OpenTracingContextKey.getKey(), span);
|
||||
Context previousCtx = ctx.attach();
|
||||
|
||||
assertEquals("active span should be OpenTracingContextKey.activeSpan()", ss.getActiveSpan(), span);
|
||||
|
||||
ctx.detach(previousCtx);
|
||||
span.finish();
|
||||
|
||||
assertEquals("active span should be null, no span in OpenTracingContextKey", ss.getActiveSpan(), null);
|
||||
}
|
||||
|
||||
}
|
||||
69
vendor/github.com/grpc-ecosystem/grpc-opentracing/java/src/test/java/io/opentracing/contrib/OpenTracingContextKeyTest.java
generated
vendored
Normal file
69
vendor/github.com/grpc-ecosystem/grpc-opentracing/java/src/test/java/io/opentracing/contrib/OpenTracingContextKeyTest.java
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
package io.opentracing.contrib;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import io.grpc.Context;
|
||||
import io.opentracing.Span;
|
||||
import io.opentracing.Tracer;
|
||||
import io.opentracing.mock.MockTracer;
|
||||
|
||||
public class OpenTracingContextKeyTest {
|
||||
|
||||
Tracer tracer = new MockTracer();
|
||||
|
||||
@Test
|
||||
public void TestGetKey() {
|
||||
Context.Key<Span> key = OpenTracingContextKey.getKey();
|
||||
assertEquals("Key should have correct name", key.toString(), (OpenTracingContextKey.KEY_NAME));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TestNoActiveSpan() {
|
||||
assertEquals("activeSpan() should return null when no span is active",
|
||||
OpenTracingContextKey.activeSpan(), null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TestGetActiveSpan() {
|
||||
Span span = tracer.buildSpan("s0").start();
|
||||
Context ctx = Context.current().withValue(OpenTracingContextKey.getKey(), span);
|
||||
Context previousCtx = ctx.attach();
|
||||
|
||||
assertEquals(OpenTracingContextKey.activeSpan(), span);
|
||||
|
||||
ctx.detach(previousCtx);
|
||||
span.finish();
|
||||
|
||||
assertEquals(OpenTracingContextKey.activeSpan(), null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TestMultipleContextLayers() {
|
||||
Span parentSpan = tracer.buildSpan("s0").start();
|
||||
Context parentCtx = Context.current().withValue(OpenTracingContextKey.getKey(), parentSpan);
|
||||
Context previousCtx = parentCtx.attach();
|
||||
|
||||
Span childSpan = tracer.buildSpan("s1").start();
|
||||
Context childCtx = Context.current().withValue(OpenTracingContextKey.getKey(), childSpan);
|
||||
parentCtx = childCtx.attach();
|
||||
|
||||
assertEquals(OpenTracingContextKey.activeSpan(), childSpan);
|
||||
|
||||
childCtx.detach(parentCtx);
|
||||
childSpan.finish();
|
||||
|
||||
assertEquals(OpenTracingContextKey.activeSpan(), parentSpan);
|
||||
|
||||
parentCtx.detach(previousCtx);
|
||||
parentSpan.finish();
|
||||
|
||||
assertEquals(OpenTracingContextKey.activeSpan(), null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TestWrappedCall() {
|
||||
|
||||
}
|
||||
}
|
||||
9
vendor/github.com/grpc-ecosystem/grpc-opentracing/java/src/test/java/io/opentracing/contrib/README.md
generated
vendored
Normal file
9
vendor/github.com/grpc-ecosystem/grpc-opentracing/java/src/test/java/io/opentracing/contrib/README.md
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
## Tests
|
||||
|
||||
To run tests for grpc-opentracing, run
|
||||
|
||||
```
|
||||
$ gradle test
|
||||
```
|
||||
|
||||
These tests use the protobuf-generated classes from grpc-example, which are located in `src/testgen`.
|
||||
39
vendor/github.com/grpc-ecosystem/grpc-opentracing/java/src/test/java/io/opentracing/contrib/TracedClient.java
generated
vendored
Normal file
39
vendor/github.com/grpc-ecosystem/grpc-opentracing/java/src/test/java/io/opentracing/contrib/TracedClient.java
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
package io.opentracing.contrib;
|
||||
|
||||
import io.grpc.ManagedChannel;
|
||||
import io.grpc.ManagedChannelBuilder;
|
||||
|
||||
public class TracedClient {
|
||||
private final ManagedChannel channel;
|
||||
private final GreeterGrpc.GreeterBlockingStub blockingStub;
|
||||
|
||||
public TracedClient(String host, int port, ClientTracingInterceptor tracingInterceptor) {
|
||||
channel = ManagedChannelBuilder.forAddress(host, port)
|
||||
.usePlaintext(true)
|
||||
.build();
|
||||
|
||||
if(tracingInterceptor==null) {
|
||||
blockingStub = GreeterGrpc.newBlockingStub(channel);
|
||||
} else {
|
||||
blockingStub = GreeterGrpc.newBlockingStub(tracingInterceptor.intercept(channel));
|
||||
}
|
||||
}
|
||||
|
||||
void shutdown() throws InterruptedException {
|
||||
channel.shutdown();
|
||||
}
|
||||
|
||||
boolean greet(String name) {
|
||||
HelloRequest request = HelloRequest.newBuilder().setName(name).build();
|
||||
try {
|
||||
blockingStub.sayHello(request);
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
} finally {
|
||||
try { this.shutdown(); }
|
||||
catch (Exception e) { return false; }
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
||||
63
vendor/github.com/grpc-ecosystem/grpc-opentracing/java/src/test/java/io/opentracing/contrib/TracedService.java
generated
vendored
Normal file
63
vendor/github.com/grpc-ecosystem/grpc-opentracing/java/src/test/java/io/opentracing/contrib/TracedService.java
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
package io.opentracing.contrib;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import io.grpc.Server;
|
||||
import io.grpc.ServerBuilder;
|
||||
import io.grpc.stub.StreamObserver;
|
||||
|
||||
public class TracedService {
|
||||
private int port = 50051;
|
||||
private Server server;
|
||||
|
||||
void start() throws IOException {
|
||||
server = ServerBuilder.forPort(port)
|
||||
.addService(new GreeterImpl())
|
||||
.build()
|
||||
.start();
|
||||
|
||||
Runtime.getRuntime().addShutdownHook(new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
TracedService.this.stop();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void startWithInterceptor(ServerTracingInterceptor tracingInterceptor) throws IOException {
|
||||
|
||||
server = ServerBuilder.forPort(port)
|
||||
.addService(tracingInterceptor.intercept(new GreeterImpl()))
|
||||
.build()
|
||||
.start();
|
||||
|
||||
Runtime.getRuntime().addShutdownHook(new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
TracedService.this.stop();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void blockUntilShutdown() throws InterruptedException {
|
||||
if (server != null) {
|
||||
server.awaitTermination();
|
||||
}
|
||||
}
|
||||
|
||||
void stop() {
|
||||
if (server != null) {
|
||||
server.shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
private class GreeterImpl extends GreeterGrpc.GreeterImplBase {
|
||||
@Override
|
||||
public void sayHello(HelloRequest req, StreamObserver<HelloReply> responseObserver) {
|
||||
HelloReply reply = HelloReply.newBuilder().setMessage("Hello").build();
|
||||
responseObserver.onNext(reply);
|
||||
responseObserver.onCompleted();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
378
vendor/github.com/grpc-ecosystem/grpc-opentracing/java/src/test/java/io/opentracing/contrib/TracingInterceptorsTest.java
generated
vendored
Normal file
378
vendor/github.com/grpc-ecosystem/grpc-opentracing/java/src/test/java/io/opentracing/contrib/TracingInterceptorsTest.java
generated
vendored
Normal file
@@ -0,0 +1,378 @@
|
||||
package io.opentracing.contrib;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import io.grpc.MethodDescriptor;
|
||||
import io.opentracing.mock.MockSpan;
|
||||
import io.opentracing.mock.MockSpan.LogEntry;
|
||||
import io.opentracing.mock.MockTracer;
|
||||
|
||||
public class TracingInterceptorsTest {
|
||||
|
||||
@Test
|
||||
public void TestTracedServerBasic() {
|
||||
TracedClient client = new TracedClient("localhost", 50051, null);
|
||||
|
||||
MockTracer serviceTracer = new MockTracer();
|
||||
ServerTracingInterceptor tracingInterceptor = new ServerTracingInterceptor(serviceTracer);
|
||||
TracedService service = new TracedService();
|
||||
|
||||
try {
|
||||
service.startWithInterceptor(tracingInterceptor);
|
||||
|
||||
assertTrue("call should complete", client.greet("world"));
|
||||
assertEquals("one span should have been created and finished for one client request",
|
||||
serviceTracer.finishedSpans().size(), 1);
|
||||
|
||||
MockSpan span = serviceTracer.finishedSpans().get(0);
|
||||
assertEquals("span should have default name", span.operationName(), "helloworld.Greeter/SayHello");
|
||||
assertEquals("span should have no parents", span.parentId(), 0);
|
||||
assertTrue("span should have no logs", span.logEntries().isEmpty());
|
||||
assertTrue("span should have no tags", span.tags().isEmpty());
|
||||
assertFalse("span should have no baggage", span.context().baggageItems().iterator().hasNext());
|
||||
} catch (Exception e) {
|
||||
assertTrue(e.getMessage(), false);
|
||||
} finally {
|
||||
service.stop();
|
||||
serviceTracer.reset();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TestTracedServerWithVerbosity() {
|
||||
TracedClient client = new TracedClient("localhost", 50051, null);
|
||||
|
||||
MockTracer serviceTracer = new MockTracer();
|
||||
TracedService service = new TracedService();
|
||||
ServerTracingInterceptor tracingInterceptor = new ServerTracingInterceptor
|
||||
.Builder(serviceTracer)
|
||||
.withVerbosity()
|
||||
.build();
|
||||
|
||||
try {
|
||||
service.startWithInterceptor(tracingInterceptor);
|
||||
|
||||
assertTrue("call should complete", client.greet("world"));
|
||||
assertEquals("one span should have been created and finished for one client request",
|
||||
serviceTracer.finishedSpans().size(), 1);
|
||||
|
||||
MockSpan span = serviceTracer.finishedSpans().get(0);
|
||||
assertEquals("span should have default name", span.operationName(), "helloworld.Greeter/SayHello");
|
||||
assertEquals("span should have no parents", span.parentId(), 0);
|
||||
assertEquals("span should log onMessage and onComplete", 2, span.logEntries().size());
|
||||
assertTrue("span should have no tags", span.tags().isEmpty());
|
||||
assertFalse("span should have no baggage", span.context().baggageItems().iterator().hasNext());
|
||||
} catch (Exception e) {
|
||||
assertTrue(e.getMessage(), false);
|
||||
} finally {
|
||||
service.stop();
|
||||
serviceTracer.reset();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TestTracedServerWithStreaming() {
|
||||
TracedClient client = new TracedClient("localhost", 50051, null);
|
||||
|
||||
MockTracer serviceTracer = new MockTracer();
|
||||
TracedService service = new TracedService();
|
||||
ServerTracingInterceptor tracingInterceptor = new ServerTracingInterceptor
|
||||
.Builder(serviceTracer)
|
||||
.withStreaming()
|
||||
.build();
|
||||
|
||||
try {
|
||||
service.startWithInterceptor(tracingInterceptor);
|
||||
|
||||
assertTrue("call should complete", client.greet("world"));
|
||||
assertEquals("one span should have been created and finished for one client request",
|
||||
serviceTracer.finishedSpans().size(), 1);
|
||||
|
||||
MockSpan span = serviceTracer.finishedSpans().get(0);
|
||||
assertEquals("span should have default name", span.operationName(), "helloworld.Greeter/SayHello");
|
||||
assertEquals("span should have no parents", span.parentId(), 0);
|
||||
assertEquals("span should log onMessage and onHalfClose", span.logEntries().size(), 2);
|
||||
assertTrue("span should have no tags", span.tags().isEmpty());
|
||||
assertFalse("span should have no baggage", span.context().baggageItems().iterator().hasNext());
|
||||
} catch (Exception e) {
|
||||
assertTrue(e.getMessage(), false);
|
||||
} finally {
|
||||
service.stop();
|
||||
serviceTracer.reset();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TestTracedServerWithCustomOperationName() {
|
||||
final String PREFIX = "testing-";
|
||||
TracedClient client = new TracedClient("localhost", 50051, null);
|
||||
|
||||
MockTracer serviceTracer = new MockTracer();
|
||||
TracedService service = new TracedService();
|
||||
ServerTracingInterceptor tracingInterceptor = new ServerTracingInterceptor
|
||||
.Builder(serviceTracer)
|
||||
.withOperationName(new OperationNameConstructor() {
|
||||
@Override
|
||||
public <ReqT, RespT> String constructOperationName(MethodDescriptor<ReqT, RespT> method) {
|
||||
return PREFIX + method.getFullMethodName();
|
||||
}
|
||||
})
|
||||
.build();
|
||||
|
||||
try {
|
||||
service.startWithInterceptor(tracingInterceptor);
|
||||
|
||||
assertTrue("call should complete", client.greet("world"));
|
||||
assertEquals("one span should have been created and finished for one client request",
|
||||
serviceTracer.finishedSpans().size(), 1);
|
||||
|
||||
MockSpan span = serviceTracer.finishedSpans().get(0);
|
||||
assertEquals("span should have prefix", span.operationName(), PREFIX + "helloworld.Greeter/SayHello");
|
||||
assertEquals("span should have no parents", span.parentId(), 0);
|
||||
assertEquals("span should have no logs", span.logEntries().size(), 0);
|
||||
assertTrue("span should have no tags", span.tags().isEmpty());
|
||||
assertFalse("span should have no baggage", span.context().baggageItems().iterator().hasNext());
|
||||
} catch (Exception e) {
|
||||
assertTrue(e.getMessage(), false);
|
||||
} finally {
|
||||
service.stop();
|
||||
serviceTracer.reset();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TestTracedServerWithTracedAttributes() {
|
||||
TracedClient client = new TracedClient("localhost", 50051, null);
|
||||
|
||||
MockTracer serviceTracer = new MockTracer();
|
||||
TracedService service = new TracedService();
|
||||
ServerTracingInterceptor tracingInterceptor = new ServerTracingInterceptor
|
||||
.Builder(serviceTracer)
|
||||
.withTracedAttributes(ServerTracingInterceptor.ServerRequestAttribute.values())
|
||||
.build();
|
||||
|
||||
try {
|
||||
service.startWithInterceptor(tracingInterceptor);
|
||||
|
||||
assertTrue("call should complete", client.greet("world"));
|
||||
assertEquals("one span should have been created and finished for one client request",
|
||||
serviceTracer.finishedSpans().size(), 1);
|
||||
|
||||
MockSpan span = serviceTracer.finishedSpans().get(0);
|
||||
assertEquals("span should have prefix", span.operationName(), "helloworld.Greeter/SayHello");
|
||||
assertEquals("span should have no parents", span.parentId(), 0);
|
||||
assertEquals("span should have no logs", span.logEntries().size(), 0);
|
||||
assertEquals("span should have a tag for each traced attribute",
|
||||
ServerTracingInterceptor.ServerRequestAttribute.values().length, span.tags().size());
|
||||
assertFalse("span should have no baggage", span.context().baggageItems().iterator().hasNext());
|
||||
} catch (Exception e) {
|
||||
assertTrue(e.getMessage(), false);
|
||||
} finally {
|
||||
service.stop();
|
||||
serviceTracer.reset();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TestTracedClientBasic() {
|
||||
TracedService service = new TracedService();
|
||||
|
||||
MockTracer clientTracer = new MockTracer();
|
||||
ClientTracingInterceptor tracingInterceptor = new ClientTracingInterceptor(clientTracer);
|
||||
TracedClient client = new TracedClient("localhost", 50051, tracingInterceptor);
|
||||
|
||||
try {
|
||||
service.start();
|
||||
|
||||
assertTrue("call should complete", client.greet("world"));
|
||||
assertEquals("one span should have been created and finished for one client request",
|
||||
clientTracer.finishedSpans().size(), 1);
|
||||
|
||||
MockSpan span = clientTracer.finishedSpans().get(0);
|
||||
assertEquals("span should have prefix", span.operationName(), "helloworld.Greeter/SayHello");
|
||||
assertEquals("span should have no parents", span.parentId(), 0);
|
||||
assertEquals("span should have no logs", span.logEntries().size(), 0);
|
||||
assertEquals("span should have no tags", span.tags().size(), 0);
|
||||
assertFalse("span should have no baggage", span.context().baggageItems().iterator().hasNext());
|
||||
} catch (Exception e) {
|
||||
assertTrue(e.getMessage(), false);
|
||||
} finally {
|
||||
service.stop();
|
||||
clientTracer.reset();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TestTracedClientWithVerbosity() {
|
||||
TracedService service = new TracedService();
|
||||
|
||||
MockTracer clientTracer = new MockTracer();
|
||||
ClientTracingInterceptor tracingInterceptor = new ClientTracingInterceptor
|
||||
.Builder(clientTracer)
|
||||
.withVerbosity()
|
||||
.build();
|
||||
TracedClient client = new TracedClient("localhost", 50051, tracingInterceptor);
|
||||
|
||||
try {
|
||||
service.start();
|
||||
|
||||
assertTrue("call should complete", client.greet("world"));
|
||||
assertEquals("one span should have been created and finished for one client request",
|
||||
clientTracer.finishedSpans().size(), 1);
|
||||
|
||||
MockSpan span = clientTracer.finishedSpans().get(0);
|
||||
assertEquals("span should have prefix", span.operationName(), "helloworld.Greeter/SayHello");
|
||||
assertEquals("span should have no parents", span.parentId(), 0);
|
||||
System.out.println(span.logEntries());
|
||||
assertEquals("span should have logs for start, onHeaders, onMessage, onClose, sendMessage", 5, span.logEntries().size());
|
||||
assertEquals("span should have no tags", span.tags().size(), 0);
|
||||
assertFalse("span should have no baggage", span.context().baggageItems().iterator().hasNext());
|
||||
} catch (Exception e) {
|
||||
assertTrue(e.getMessage(), false);
|
||||
} finally {
|
||||
service.stop();
|
||||
clientTracer.reset();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TestTracedClientWithStreaming() {
|
||||
TracedService service = new TracedService();
|
||||
|
||||
MockTracer clientTracer = new MockTracer();
|
||||
ClientTracingInterceptor tracingInterceptor = new ClientTracingInterceptor
|
||||
.Builder(clientTracer)
|
||||
.withStreaming()
|
||||
.build();
|
||||
TracedClient client = new TracedClient("localhost", 50051, tracingInterceptor);
|
||||
|
||||
try {
|
||||
service.start();
|
||||
|
||||
assertTrue("call should complete", client.greet("world"));
|
||||
assertEquals("one span should have been created and finished for one client request",
|
||||
clientTracer.finishedSpans().size(), 1);
|
||||
|
||||
MockSpan span = clientTracer.finishedSpans().get(0);
|
||||
assertEquals("span should have prefix", span.operationName(), "helloworld.Greeter/SayHello");
|
||||
assertEquals("span should have no parents", span.parentId(), 0);
|
||||
assertEquals("span should have log for onMessage, halfClose, sendMessage", 3, span.logEntries().size());
|
||||
assertEquals("span should have no tags", span.tags().size(), 0);
|
||||
assertFalse("span should have no baggage", span.context().baggageItems().iterator().hasNext());
|
||||
} catch (Exception e) {
|
||||
assertTrue(e.getMessage(), false);
|
||||
} finally {
|
||||
service.stop();
|
||||
clientTracer.reset();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TestTracedClientWithOperationName() {
|
||||
TracedService service = new TracedService();
|
||||
final String PREFIX = "testing-";
|
||||
|
||||
MockTracer clientTracer = new MockTracer();
|
||||
ClientTracingInterceptor tracingInterceptor = new ClientTracingInterceptor
|
||||
.Builder(clientTracer)
|
||||
.withOperationName(new OperationNameConstructor() {
|
||||
@Override
|
||||
public <ReqT, RespT> String constructOperationName(MethodDescriptor<ReqT, RespT> method) {
|
||||
return PREFIX + method.getFullMethodName();
|
||||
}
|
||||
})
|
||||
.build();
|
||||
TracedClient client = new TracedClient("localhost", 50051, tracingInterceptor);
|
||||
|
||||
try {
|
||||
service.start();
|
||||
|
||||
assertTrue("call should complete", client.greet("world"));
|
||||
assertEquals("one span should have been created and finished for one client request",
|
||||
clientTracer.finishedSpans().size(), 1);
|
||||
|
||||
MockSpan span = clientTracer.finishedSpans().get(0);
|
||||
assertEquals("span should have prefix", span.operationName(), PREFIX + "helloworld.Greeter/SayHello");
|
||||
assertEquals("span should have no parents", span.parentId(), 0);
|
||||
assertEquals("span should have no logs", span.logEntries().size(), 0);
|
||||
assertEquals("span should have no tags", span.tags().size(), 0);
|
||||
assertFalse("span should have no baggage", span.context().baggageItems().iterator().hasNext());
|
||||
} catch (Exception e) {
|
||||
assertTrue(e.getMessage(), false);
|
||||
} finally {
|
||||
service.stop();
|
||||
clientTracer.reset();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TestTracedClientWithTracedAttributes() {
|
||||
TracedService service = new TracedService();
|
||||
|
||||
MockTracer clientTracer = new MockTracer();
|
||||
ClientTracingInterceptor tracingInterceptor = new ClientTracingInterceptor
|
||||
.Builder(clientTracer)
|
||||
.withTracedAttributes(ClientTracingInterceptor.ClientRequestAttribute.values())
|
||||
.build();
|
||||
TracedClient client = new TracedClient("localhost", 50051, tracingInterceptor);
|
||||
|
||||
try {
|
||||
service.start();
|
||||
|
||||
assertTrue("call should complete", client.greet("world"));
|
||||
assertEquals("one span should have been created and finished for one client request",
|
||||
clientTracer.finishedSpans().size(), 1);
|
||||
|
||||
MockSpan span = clientTracer.finishedSpans().get(0);
|
||||
assertEquals("span should have prefix", span.operationName(), "helloworld.Greeter/SayHello");
|
||||
assertEquals("span should have no parents", span.parentId(), 0);
|
||||
assertEquals("span should have no logs", span.logEntries().size(), 0);
|
||||
assertEquals("span should have tags for all client request attributes",
|
||||
ClientTracingInterceptor.ClientRequestAttribute.values().length, span.tags().size());
|
||||
assertFalse("span should have no baggage", span.context().baggageItems().iterator().hasNext());
|
||||
} catch (Exception e) {
|
||||
assertTrue(e.getMessage(), false);
|
||||
} finally {
|
||||
service.stop();
|
||||
clientTracer.reset();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TestTracedClientAndServer() {
|
||||
MockTracer clientTracer = new MockTracer();
|
||||
MockTracer serverTracer = new MockTracer();
|
||||
|
||||
ClientTracingInterceptor tracingInterceptor = new ClientTracingInterceptor(clientTracer);
|
||||
TracedClient client = new TracedClient("localhost", 50051, tracingInterceptor);
|
||||
|
||||
ServerTracingInterceptor serverTracingInterceptor = new ServerTracingInterceptor(serverTracer);
|
||||
TracedService service = new TracedService();
|
||||
|
||||
try {
|
||||
service.startWithInterceptor(serverTracingInterceptor);
|
||||
|
||||
assertTrue("call should complete", client.greet("world"));
|
||||
assertEquals("a client span should have been created for the request",
|
||||
1, clientTracer.finishedSpans().size());
|
||||
assertEquals("a server span should have been created for the request",
|
||||
1, serverTracer.finishedSpans().size());
|
||||
|
||||
MockSpan serverSpan = serverTracer.finishedSpans().get(0);
|
||||
MockSpan clientSpan = clientTracer.finishedSpans().get(0);
|
||||
// should ideally also make sure that the parent/child relation is there, but the MockTracer
|
||||
// doesn't allow for creating new contexts outside of its package to pass in to asChildOf
|
||||
assertTrue("client span should start before server span", clientSpan.startMicros() <= serverSpan.startMicros());
|
||||
assertTrue("client span should end after server span", clientSpan.finishMicros() >= serverSpan.finishMicros());
|
||||
} catch (Exception e) {
|
||||
assertTrue(e.getMessage(), false);
|
||||
} finally {
|
||||
service.stop();
|
||||
clientTracer.reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
251
vendor/github.com/grpc-ecosystem/grpc-opentracing/java/src/testgen/io/opentracing/contrib/GreeterGrpc.java
generated
vendored
Normal file
251
vendor/github.com/grpc-ecosystem/grpc-opentracing/java/src/testgen/io/opentracing/contrib/GreeterGrpc.java
generated
vendored
Normal file
@@ -0,0 +1,251 @@
|
||||
package io.opentracing.contrib;
|
||||
|
||||
import static io.grpc.MethodDescriptor.generateFullMethodName;
|
||||
import static io.grpc.stub.ClientCalls.asyncUnaryCall;
|
||||
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
|
||||
import static io.grpc.stub.ClientCalls.futureUnaryCall;
|
||||
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
|
||||
import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* The greeting service definition.
|
||||
* </pre>
|
||||
*/
|
||||
@javax.annotation.Generated(
|
||||
value = "by gRPC proto compiler (version 0.15.0)",
|
||||
comments = "Source: helloworld.proto")
|
||||
public class GreeterGrpc {
|
||||
|
||||
private GreeterGrpc() {}
|
||||
|
||||
public static final String SERVICE_NAME = "helloworld.Greeter";
|
||||
|
||||
// Static method descriptors that strictly reflect the proto.
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
|
||||
public static final io.grpc.MethodDescriptor<io.opentracing.contrib.HelloRequest,
|
||||
io.opentracing.contrib.HelloReply> METHOD_SAY_HELLO =
|
||||
io.grpc.MethodDescriptor.create(
|
||||
io.grpc.MethodDescriptor.MethodType.UNARY,
|
||||
generateFullMethodName(
|
||||
"helloworld.Greeter", "SayHello"),
|
||||
io.grpc.protobuf.ProtoUtils.marshaller(io.opentracing.contrib.HelloRequest.getDefaultInstance()),
|
||||
io.grpc.protobuf.ProtoUtils.marshaller(io.opentracing.contrib.HelloReply.getDefaultInstance()));
|
||||
|
||||
/**
|
||||
* Creates a new async stub that supports all call types for the service
|
||||
*/
|
||||
public static GreeterStub newStub(io.grpc.Channel channel) {
|
||||
return new GreeterStub(channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
public static GreeterBlockingStub newBlockingStub(
|
||||
io.grpc.Channel channel) {
|
||||
return new GreeterBlockingStub(channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new ListenableFuture-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
public static GreeterFutureStub newFutureStub(
|
||||
io.grpc.Channel channel) {
|
||||
return new GreeterFutureStub(channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* The greeting service definition.
|
||||
* </pre>
|
||||
*/
|
||||
@java.lang.Deprecated public static interface Greeter {
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Sends a greeting
|
||||
* </pre>
|
||||
*/
|
||||
public void sayHello(io.opentracing.contrib.HelloRequest request,
|
||||
io.grpc.stub.StreamObserver<io.opentracing.contrib.HelloReply> responseObserver);
|
||||
}
|
||||
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1469")
|
||||
public static abstract class GreeterImplBase implements Greeter, io.grpc.BindableService {
|
||||
|
||||
@java.lang.Override
|
||||
public void sayHello(io.opentracing.contrib.HelloRequest request,
|
||||
io.grpc.stub.StreamObserver<io.opentracing.contrib.HelloReply> responseObserver) {
|
||||
asyncUnimplementedUnaryCall(METHOD_SAY_HELLO, responseObserver);
|
||||
}
|
||||
|
||||
@java.lang.Override public io.grpc.ServerServiceDefinition bindService() {
|
||||
return GreeterGrpc.bindService(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* The greeting service definition.
|
||||
* </pre>
|
||||
*/
|
||||
@java.lang.Deprecated public static interface GreeterBlockingClient {
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Sends a greeting
|
||||
* </pre>
|
||||
*/
|
||||
public io.opentracing.contrib.HelloReply sayHello(io.opentracing.contrib.HelloRequest request);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* The greeting service definition.
|
||||
* </pre>
|
||||
*/
|
||||
@java.lang.Deprecated public static interface GreeterFutureClient {
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Sends a greeting
|
||||
* </pre>
|
||||
*/
|
||||
public com.google.common.util.concurrent.ListenableFuture<io.opentracing.contrib.HelloReply> sayHello(
|
||||
io.opentracing.contrib.HelloRequest request);
|
||||
}
|
||||
|
||||
public static class GreeterStub extends io.grpc.stub.AbstractStub<GreeterStub>
|
||||
implements Greeter {
|
||||
private GreeterStub(io.grpc.Channel channel) {
|
||||
super(channel);
|
||||
}
|
||||
|
||||
private GreeterStub(io.grpc.Channel channel,
|
||||
io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected GreeterStub build(io.grpc.Channel channel,
|
||||
io.grpc.CallOptions callOptions) {
|
||||
return new GreeterStub(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public void sayHello(io.opentracing.contrib.HelloRequest request,
|
||||
io.grpc.stub.StreamObserver<io.opentracing.contrib.HelloReply> responseObserver) {
|
||||
asyncUnaryCall(
|
||||
getChannel().newCall(METHOD_SAY_HELLO, getCallOptions()), request, responseObserver);
|
||||
}
|
||||
}
|
||||
|
||||
public static class GreeterBlockingStub extends io.grpc.stub.AbstractStub<GreeterBlockingStub>
|
||||
implements GreeterBlockingClient {
|
||||
private GreeterBlockingStub(io.grpc.Channel channel) {
|
||||
super(channel);
|
||||
}
|
||||
|
||||
private GreeterBlockingStub(io.grpc.Channel channel,
|
||||
io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected GreeterBlockingStub build(io.grpc.Channel channel,
|
||||
io.grpc.CallOptions callOptions) {
|
||||
return new GreeterBlockingStub(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public io.opentracing.contrib.HelloReply sayHello(io.opentracing.contrib.HelloRequest request) {
|
||||
return blockingUnaryCall(
|
||||
getChannel(), METHOD_SAY_HELLO, getCallOptions(), request);
|
||||
}
|
||||
}
|
||||
|
||||
public static class GreeterFutureStub extends io.grpc.stub.AbstractStub<GreeterFutureStub>
|
||||
implements GreeterFutureClient {
|
||||
private GreeterFutureStub(io.grpc.Channel channel) {
|
||||
super(channel);
|
||||
}
|
||||
|
||||
private GreeterFutureStub(io.grpc.Channel channel,
|
||||
io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected GreeterFutureStub build(io.grpc.Channel channel,
|
||||
io.grpc.CallOptions callOptions) {
|
||||
return new GreeterFutureStub(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public com.google.common.util.concurrent.ListenableFuture<io.opentracing.contrib.HelloReply> sayHello(
|
||||
io.opentracing.contrib.HelloRequest request) {
|
||||
return futureUnaryCall(
|
||||
getChannel().newCall(METHOD_SAY_HELLO, getCallOptions()), request);
|
||||
}
|
||||
}
|
||||
|
||||
@java.lang.Deprecated public static abstract class AbstractGreeter extends GreeterImplBase {}
|
||||
|
||||
private static final int METHODID_SAY_HELLO = 0;
|
||||
|
||||
private static class MethodHandlers<Req, Resp> implements
|
||||
io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
|
||||
io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
|
||||
io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
|
||||
io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
|
||||
private final Greeter serviceImpl;
|
||||
private final int methodId;
|
||||
|
||||
public MethodHandlers(Greeter serviceImpl, int methodId) {
|
||||
this.serviceImpl = serviceImpl;
|
||||
this.methodId = methodId;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
@java.lang.SuppressWarnings("unchecked")
|
||||
public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
|
||||
switch (methodId) {
|
||||
case METHODID_SAY_HELLO:
|
||||
serviceImpl.sayHello((io.opentracing.contrib.HelloRequest) request,
|
||||
(io.grpc.stub.StreamObserver<io.opentracing.contrib.HelloReply>) responseObserver);
|
||||
break;
|
||||
default:
|
||||
throw new AssertionError();
|
||||
}
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
@java.lang.SuppressWarnings("unchecked")
|
||||
public io.grpc.stub.StreamObserver<Req> invoke(
|
||||
io.grpc.stub.StreamObserver<Resp> responseObserver) {
|
||||
switch (methodId) {
|
||||
default:
|
||||
throw new AssertionError();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static io.grpc.ServiceDescriptor getServiceDescriptor() {
|
||||
return new io.grpc.ServiceDescriptor(SERVICE_NAME,
|
||||
METHOD_SAY_HELLO);
|
||||
}
|
||||
|
||||
@java.lang.Deprecated public static io.grpc.ServerServiceDefinition bindService(
|
||||
final Greeter serviceImpl) {
|
||||
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
|
||||
.addMethod(
|
||||
METHOD_SAY_HELLO,
|
||||
asyncUnaryCall(
|
||||
new MethodHandlers<
|
||||
io.opentracing.contrib.HelloRequest,
|
||||
io.opentracing.contrib.HelloReply>(
|
||||
serviceImpl, METHODID_SAY_HELLO)))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
445
vendor/github.com/grpc-ecosystem/grpc-opentracing/java/src/testgen/io/opentracing/contrib/HelloReply.java
generated
vendored
Normal file
445
vendor/github.com/grpc-ecosystem/grpc-opentracing/java/src/testgen/io/opentracing/contrib/HelloReply.java
generated
vendored
Normal file
@@ -0,0 +1,445 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: helloworld.proto
|
||||
|
||||
package io.opentracing.contrib;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* The response message containing the greetings
|
||||
* </pre>
|
||||
*
|
||||
* Protobuf type {@code helloworld.HelloReply}
|
||||
*/
|
||||
public final class HelloReply extends
|
||||
com.google.protobuf.GeneratedMessage implements
|
||||
// @@protoc_insertion_point(message_implements:helloworld.HelloReply)
|
||||
HelloReplyOrBuilder {
|
||||
// Use HelloReply.newBuilder() to construct.
|
||||
private HelloReply(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
|
||||
super(builder);
|
||||
}
|
||||
private HelloReply() {
|
||||
message_ = "";
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public final com.google.protobuf.UnknownFieldSet
|
||||
getUnknownFields() {
|
||||
return com.google.protobuf.UnknownFieldSet.getDefaultInstance();
|
||||
}
|
||||
private HelloReply(
|
||||
com.google.protobuf.CodedInputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
this();
|
||||
int mutable_bitField0_ = 0;
|
||||
try {
|
||||
boolean done = false;
|
||||
while (!done) {
|
||||
int tag = input.readTag();
|
||||
switch (tag) {
|
||||
case 0:
|
||||
done = true;
|
||||
break;
|
||||
default: {
|
||||
if (!input.skipField(tag)) {
|
||||
done = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 10: {
|
||||
java.lang.String s = input.readStringRequireUtf8();
|
||||
|
||||
message_ = s;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
|
||||
throw e.setUnfinishedMessage(this);
|
||||
} catch (java.io.IOException e) {
|
||||
throw new com.google.protobuf.InvalidProtocolBufferException(
|
||||
e).setUnfinishedMessage(this);
|
||||
} finally {
|
||||
makeExtensionsImmutable();
|
||||
}
|
||||
}
|
||||
public static final com.google.protobuf.Descriptors.Descriptor
|
||||
getDescriptor() {
|
||||
return io.opentracing.contrib.HelloWorldProto.internal_static_helloworld_HelloReply_descriptor;
|
||||
}
|
||||
|
||||
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
|
||||
internalGetFieldAccessorTable() {
|
||||
return io.opentracing.contrib.HelloWorldProto.internal_static_helloworld_HelloReply_fieldAccessorTable
|
||||
.ensureFieldAccessorsInitialized(
|
||||
io.opentracing.contrib.HelloReply.class, io.opentracing.contrib.HelloReply.Builder.class);
|
||||
}
|
||||
|
||||
public static final int MESSAGE_FIELD_NUMBER = 1;
|
||||
private volatile java.lang.Object message_;
|
||||
/**
|
||||
* <code>optional string message = 1;</code>
|
||||
*/
|
||||
public java.lang.String getMessage() {
|
||||
java.lang.Object ref = message_;
|
||||
if (ref instanceof java.lang.String) {
|
||||
return (java.lang.String) ref;
|
||||
} else {
|
||||
com.google.protobuf.ByteString bs =
|
||||
(com.google.protobuf.ByteString) ref;
|
||||
java.lang.String s = bs.toStringUtf8();
|
||||
message_ = s;
|
||||
return s;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>optional string message = 1;</code>
|
||||
*/
|
||||
public com.google.protobuf.ByteString
|
||||
getMessageBytes() {
|
||||
java.lang.Object ref = message_;
|
||||
if (ref instanceof java.lang.String) {
|
||||
com.google.protobuf.ByteString b =
|
||||
com.google.protobuf.ByteString.copyFromUtf8(
|
||||
(java.lang.String) ref);
|
||||
message_ = b;
|
||||
return b;
|
||||
} else {
|
||||
return (com.google.protobuf.ByteString) ref;
|
||||
}
|
||||
}
|
||||
|
||||
private byte memoizedIsInitialized = -1;
|
||||
public final boolean isInitialized() {
|
||||
byte isInitialized = memoizedIsInitialized;
|
||||
if (isInitialized == 1) return true;
|
||||
if (isInitialized == 0) return false;
|
||||
|
||||
memoizedIsInitialized = 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void writeTo(com.google.protobuf.CodedOutputStream output)
|
||||
throws java.io.IOException {
|
||||
if (!getMessageBytes().isEmpty()) {
|
||||
com.google.protobuf.GeneratedMessage.writeString(output, 1, message_);
|
||||
}
|
||||
}
|
||||
|
||||
public int getSerializedSize() {
|
||||
int size = memoizedSize;
|
||||
if (size != -1) return size;
|
||||
|
||||
size = 0;
|
||||
if (!getMessageBytes().isEmpty()) {
|
||||
size += com.google.protobuf.GeneratedMessage.computeStringSize(1, message_);
|
||||
}
|
||||
memoizedSize = size;
|
||||
return size;
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = 0L;
|
||||
public static io.opentracing.contrib.HelloReply parseFrom(
|
||||
com.google.protobuf.ByteString data)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return PARSER.parseFrom(data);
|
||||
}
|
||||
public static io.opentracing.contrib.HelloReply parseFrom(
|
||||
com.google.protobuf.ByteString data,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return PARSER.parseFrom(data, extensionRegistry);
|
||||
}
|
||||
public static io.opentracing.contrib.HelloReply parseFrom(byte[] data)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return PARSER.parseFrom(data);
|
||||
}
|
||||
public static io.opentracing.contrib.HelloReply parseFrom(
|
||||
byte[] data,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return PARSER.parseFrom(data, extensionRegistry);
|
||||
}
|
||||
public static io.opentracing.contrib.HelloReply parseFrom(java.io.InputStream input)
|
||||
throws java.io.IOException {
|
||||
return com.google.protobuf.GeneratedMessage
|
||||
.parseWithIOException(PARSER, input);
|
||||
}
|
||||
public static io.opentracing.contrib.HelloReply parseFrom(
|
||||
java.io.InputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws java.io.IOException {
|
||||
return com.google.protobuf.GeneratedMessage
|
||||
.parseWithIOException(PARSER, input, extensionRegistry);
|
||||
}
|
||||
public static io.opentracing.contrib.HelloReply parseDelimitedFrom(java.io.InputStream input)
|
||||
throws java.io.IOException {
|
||||
return com.google.protobuf.GeneratedMessage
|
||||
.parseDelimitedWithIOException(PARSER, input);
|
||||
}
|
||||
public static io.opentracing.contrib.HelloReply parseDelimitedFrom(
|
||||
java.io.InputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws java.io.IOException {
|
||||
return com.google.protobuf.GeneratedMessage
|
||||
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
|
||||
}
|
||||
public static io.opentracing.contrib.HelloReply parseFrom(
|
||||
com.google.protobuf.CodedInputStream input)
|
||||
throws java.io.IOException {
|
||||
return com.google.protobuf.GeneratedMessage
|
||||
.parseWithIOException(PARSER, input);
|
||||
}
|
||||
public static io.opentracing.contrib.HelloReply parseFrom(
|
||||
com.google.protobuf.CodedInputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws java.io.IOException {
|
||||
return com.google.protobuf.GeneratedMessage
|
||||
.parseWithIOException(PARSER, input, extensionRegistry);
|
||||
}
|
||||
|
||||
public Builder newBuilderForType() { return newBuilder(); }
|
||||
public static Builder newBuilder() {
|
||||
return DEFAULT_INSTANCE.toBuilder();
|
||||
}
|
||||
public static Builder newBuilder(io.opentracing.contrib.HelloReply prototype) {
|
||||
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
|
||||
}
|
||||
public Builder toBuilder() {
|
||||
return this == DEFAULT_INSTANCE
|
||||
? new Builder() : new Builder().mergeFrom(this);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected Builder newBuilderForType(
|
||||
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
|
||||
Builder builder = new Builder(parent);
|
||||
return builder;
|
||||
}
|
||||
/**
|
||||
* <pre>
|
||||
* The response message containing the greetings
|
||||
* </pre>
|
||||
*
|
||||
* Protobuf type {@code helloworld.HelloReply}
|
||||
*/
|
||||
public static final class Builder extends
|
||||
com.google.protobuf.GeneratedMessage.Builder<Builder> implements
|
||||
// @@protoc_insertion_point(builder_implements:helloworld.HelloReply)
|
||||
io.opentracing.contrib.HelloReplyOrBuilder {
|
||||
public static final com.google.protobuf.Descriptors.Descriptor
|
||||
getDescriptor() {
|
||||
return io.opentracing.contrib.HelloWorldProto.internal_static_helloworld_HelloReply_descriptor;
|
||||
}
|
||||
|
||||
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
|
||||
internalGetFieldAccessorTable() {
|
||||
return io.opentracing.contrib.HelloWorldProto.internal_static_helloworld_HelloReply_fieldAccessorTable
|
||||
.ensureFieldAccessorsInitialized(
|
||||
io.opentracing.contrib.HelloReply.class, io.opentracing.contrib.HelloReply.Builder.class);
|
||||
}
|
||||
|
||||
// Construct using io.opentracing.contrib.HelloReply.newBuilder()
|
||||
private Builder() {
|
||||
maybeForceBuilderInitialization();
|
||||
}
|
||||
|
||||
private Builder(
|
||||
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
|
||||
super(parent);
|
||||
maybeForceBuilderInitialization();
|
||||
}
|
||||
private void maybeForceBuilderInitialization() {
|
||||
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
|
||||
}
|
||||
}
|
||||
public Builder clear() {
|
||||
super.clear();
|
||||
message_ = "";
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public com.google.protobuf.Descriptors.Descriptor
|
||||
getDescriptorForType() {
|
||||
return io.opentracing.contrib.HelloWorldProto.internal_static_helloworld_HelloReply_descriptor;
|
||||
}
|
||||
|
||||
public io.opentracing.contrib.HelloReply getDefaultInstanceForType() {
|
||||
return io.opentracing.contrib.HelloReply.getDefaultInstance();
|
||||
}
|
||||
|
||||
public io.opentracing.contrib.HelloReply build() {
|
||||
io.opentracing.contrib.HelloReply result = buildPartial();
|
||||
if (!result.isInitialized()) {
|
||||
throw newUninitializedMessageException(result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public io.opentracing.contrib.HelloReply buildPartial() {
|
||||
io.opentracing.contrib.HelloReply result = new io.opentracing.contrib.HelloReply(this);
|
||||
result.message_ = message_;
|
||||
onBuilt();
|
||||
return result;
|
||||
}
|
||||
|
||||
public Builder mergeFrom(com.google.protobuf.Message other) {
|
||||
if (other instanceof io.opentracing.contrib.HelloReply) {
|
||||
return mergeFrom((io.opentracing.contrib.HelloReply)other);
|
||||
} else {
|
||||
super.mergeFrom(other);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public Builder mergeFrom(io.opentracing.contrib.HelloReply other) {
|
||||
if (other == io.opentracing.contrib.HelloReply.getDefaultInstance()) return this;
|
||||
if (!other.getMessage().isEmpty()) {
|
||||
message_ = other.message_;
|
||||
onChanged();
|
||||
}
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
|
||||
public final boolean isInitialized() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public Builder mergeFrom(
|
||||
com.google.protobuf.CodedInputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws java.io.IOException {
|
||||
io.opentracing.contrib.HelloReply parsedMessage = null;
|
||||
try {
|
||||
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
|
||||
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
|
||||
parsedMessage = (io.opentracing.contrib.HelloReply) e.getUnfinishedMessage();
|
||||
throw e.unwrapIOException();
|
||||
} finally {
|
||||
if (parsedMessage != null) {
|
||||
mergeFrom(parsedMessage);
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
private java.lang.Object message_ = "";
|
||||
/**
|
||||
* <code>optional string message = 1;</code>
|
||||
*/
|
||||
public java.lang.String getMessage() {
|
||||
java.lang.Object ref = message_;
|
||||
if (!(ref instanceof java.lang.String)) {
|
||||
com.google.protobuf.ByteString bs =
|
||||
(com.google.protobuf.ByteString) ref;
|
||||
java.lang.String s = bs.toStringUtf8();
|
||||
message_ = s;
|
||||
return s;
|
||||
} else {
|
||||
return (java.lang.String) ref;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>optional string message = 1;</code>
|
||||
*/
|
||||
public com.google.protobuf.ByteString
|
||||
getMessageBytes() {
|
||||
java.lang.Object ref = message_;
|
||||
if (ref instanceof String) {
|
||||
com.google.protobuf.ByteString b =
|
||||
com.google.protobuf.ByteString.copyFromUtf8(
|
||||
(java.lang.String) ref);
|
||||
message_ = b;
|
||||
return b;
|
||||
} else {
|
||||
return (com.google.protobuf.ByteString) ref;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>optional string message = 1;</code>
|
||||
*/
|
||||
public Builder setMessage(
|
||||
java.lang.String value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
|
||||
message_ = value;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional string message = 1;</code>
|
||||
*/
|
||||
public Builder clearMessage() {
|
||||
|
||||
message_ = getDefaultInstance().getMessage();
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional string message = 1;</code>
|
||||
*/
|
||||
public Builder setMessageBytes(
|
||||
com.google.protobuf.ByteString value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
checkByteStringIsUtf8(value);
|
||||
|
||||
message_ = value;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
public final Builder setUnknownFields(
|
||||
final com.google.protobuf.UnknownFieldSet unknownFields) {
|
||||
return this;
|
||||
}
|
||||
|
||||
public final Builder mergeUnknownFields(
|
||||
final com.google.protobuf.UnknownFieldSet unknownFields) {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
// @@protoc_insertion_point(builder_scope:helloworld.HelloReply)
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(class_scope:helloworld.HelloReply)
|
||||
private static final io.opentracing.contrib.HelloReply DEFAULT_INSTANCE;
|
||||
static {
|
||||
DEFAULT_INSTANCE = new io.opentracing.contrib.HelloReply();
|
||||
}
|
||||
|
||||
public static io.opentracing.contrib.HelloReply getDefaultInstance() {
|
||||
return DEFAULT_INSTANCE;
|
||||
}
|
||||
|
||||
private static final com.google.protobuf.Parser<HelloReply>
|
||||
PARSER = new com.google.protobuf.AbstractParser<HelloReply>() {
|
||||
public HelloReply parsePartialFrom(
|
||||
com.google.protobuf.CodedInputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return new HelloReply(input, extensionRegistry);
|
||||
}
|
||||
};
|
||||
|
||||
public static com.google.protobuf.Parser<HelloReply> parser() {
|
||||
return PARSER;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public com.google.protobuf.Parser<HelloReply> getParserForType() {
|
||||
return PARSER;
|
||||
}
|
||||
|
||||
public io.opentracing.contrib.HelloReply getDefaultInstanceForType() {
|
||||
return DEFAULT_INSTANCE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
19
vendor/github.com/grpc-ecosystem/grpc-opentracing/java/src/testgen/io/opentracing/contrib/HelloReplyOrBuilder.java
generated
vendored
Normal file
19
vendor/github.com/grpc-ecosystem/grpc-opentracing/java/src/testgen/io/opentracing/contrib/HelloReplyOrBuilder.java
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: helloworld.proto
|
||||
|
||||
package io.opentracing.contrib;
|
||||
|
||||
public interface HelloReplyOrBuilder extends
|
||||
// @@protoc_insertion_point(interface_extends:helloworld.HelloReply)
|
||||
com.google.protobuf.MessageOrBuilder {
|
||||
|
||||
/**
|
||||
* <code>optional string message = 1;</code>
|
||||
*/
|
||||
java.lang.String getMessage();
|
||||
/**
|
||||
* <code>optional string message = 1;</code>
|
||||
*/
|
||||
com.google.protobuf.ByteString
|
||||
getMessageBytes();
|
||||
}
|
||||
445
vendor/github.com/grpc-ecosystem/grpc-opentracing/java/src/testgen/io/opentracing/contrib/HelloRequest.java
generated
vendored
Normal file
445
vendor/github.com/grpc-ecosystem/grpc-opentracing/java/src/testgen/io/opentracing/contrib/HelloRequest.java
generated
vendored
Normal file
@@ -0,0 +1,445 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: helloworld.proto
|
||||
|
||||
package io.opentracing.contrib;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* The request message containing the user's name.
|
||||
* </pre>
|
||||
*
|
||||
* Protobuf type {@code helloworld.HelloRequest}
|
||||
*/
|
||||
public final class HelloRequest extends
|
||||
com.google.protobuf.GeneratedMessage implements
|
||||
// @@protoc_insertion_point(message_implements:helloworld.HelloRequest)
|
||||
HelloRequestOrBuilder {
|
||||
// Use HelloRequest.newBuilder() to construct.
|
||||
private HelloRequest(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
|
||||
super(builder);
|
||||
}
|
||||
private HelloRequest() {
|
||||
name_ = "";
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public final com.google.protobuf.UnknownFieldSet
|
||||
getUnknownFields() {
|
||||
return com.google.protobuf.UnknownFieldSet.getDefaultInstance();
|
||||
}
|
||||
private HelloRequest(
|
||||
com.google.protobuf.CodedInputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
this();
|
||||
int mutable_bitField0_ = 0;
|
||||
try {
|
||||
boolean done = false;
|
||||
while (!done) {
|
||||
int tag = input.readTag();
|
||||
switch (tag) {
|
||||
case 0:
|
||||
done = true;
|
||||
break;
|
||||
default: {
|
||||
if (!input.skipField(tag)) {
|
||||
done = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 10: {
|
||||
java.lang.String s = input.readStringRequireUtf8();
|
||||
|
||||
name_ = s;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
|
||||
throw e.setUnfinishedMessage(this);
|
||||
} catch (java.io.IOException e) {
|
||||
throw new com.google.protobuf.InvalidProtocolBufferException(
|
||||
e).setUnfinishedMessage(this);
|
||||
} finally {
|
||||
makeExtensionsImmutable();
|
||||
}
|
||||
}
|
||||
public static final com.google.protobuf.Descriptors.Descriptor
|
||||
getDescriptor() {
|
||||
return io.opentracing.contrib.HelloWorldProto.internal_static_helloworld_HelloRequest_descriptor;
|
||||
}
|
||||
|
||||
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
|
||||
internalGetFieldAccessorTable() {
|
||||
return io.opentracing.contrib.HelloWorldProto.internal_static_helloworld_HelloRequest_fieldAccessorTable
|
||||
.ensureFieldAccessorsInitialized(
|
||||
io.opentracing.contrib.HelloRequest.class, io.opentracing.contrib.HelloRequest.Builder.class);
|
||||
}
|
||||
|
||||
public static final int NAME_FIELD_NUMBER = 1;
|
||||
private volatile java.lang.Object name_;
|
||||
/**
|
||||
* <code>optional string name = 1;</code>
|
||||
*/
|
||||
public java.lang.String getName() {
|
||||
java.lang.Object ref = name_;
|
||||
if (ref instanceof java.lang.String) {
|
||||
return (java.lang.String) ref;
|
||||
} else {
|
||||
com.google.protobuf.ByteString bs =
|
||||
(com.google.protobuf.ByteString) ref;
|
||||
java.lang.String s = bs.toStringUtf8();
|
||||
name_ = s;
|
||||
return s;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>optional string name = 1;</code>
|
||||
*/
|
||||
public com.google.protobuf.ByteString
|
||||
getNameBytes() {
|
||||
java.lang.Object ref = name_;
|
||||
if (ref instanceof java.lang.String) {
|
||||
com.google.protobuf.ByteString b =
|
||||
com.google.protobuf.ByteString.copyFromUtf8(
|
||||
(java.lang.String) ref);
|
||||
name_ = b;
|
||||
return b;
|
||||
} else {
|
||||
return (com.google.protobuf.ByteString) ref;
|
||||
}
|
||||
}
|
||||
|
||||
private byte memoizedIsInitialized = -1;
|
||||
public final boolean isInitialized() {
|
||||
byte isInitialized = memoizedIsInitialized;
|
||||
if (isInitialized == 1) return true;
|
||||
if (isInitialized == 0) return false;
|
||||
|
||||
memoizedIsInitialized = 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void writeTo(com.google.protobuf.CodedOutputStream output)
|
||||
throws java.io.IOException {
|
||||
if (!getNameBytes().isEmpty()) {
|
||||
com.google.protobuf.GeneratedMessage.writeString(output, 1, name_);
|
||||
}
|
||||
}
|
||||
|
||||
public int getSerializedSize() {
|
||||
int size = memoizedSize;
|
||||
if (size != -1) return size;
|
||||
|
||||
size = 0;
|
||||
if (!getNameBytes().isEmpty()) {
|
||||
size += com.google.protobuf.GeneratedMessage.computeStringSize(1, name_);
|
||||
}
|
||||
memoizedSize = size;
|
||||
return size;
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = 0L;
|
||||
public static io.opentracing.contrib.HelloRequest parseFrom(
|
||||
com.google.protobuf.ByteString data)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return PARSER.parseFrom(data);
|
||||
}
|
||||
public static io.opentracing.contrib.HelloRequest parseFrom(
|
||||
com.google.protobuf.ByteString data,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return PARSER.parseFrom(data, extensionRegistry);
|
||||
}
|
||||
public static io.opentracing.contrib.HelloRequest parseFrom(byte[] data)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return PARSER.parseFrom(data);
|
||||
}
|
||||
public static io.opentracing.contrib.HelloRequest parseFrom(
|
||||
byte[] data,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return PARSER.parseFrom(data, extensionRegistry);
|
||||
}
|
||||
public static io.opentracing.contrib.HelloRequest parseFrom(java.io.InputStream input)
|
||||
throws java.io.IOException {
|
||||
return com.google.protobuf.GeneratedMessage
|
||||
.parseWithIOException(PARSER, input);
|
||||
}
|
||||
public static io.opentracing.contrib.HelloRequest parseFrom(
|
||||
java.io.InputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws java.io.IOException {
|
||||
return com.google.protobuf.GeneratedMessage
|
||||
.parseWithIOException(PARSER, input, extensionRegistry);
|
||||
}
|
||||
public static io.opentracing.contrib.HelloRequest parseDelimitedFrom(java.io.InputStream input)
|
||||
throws java.io.IOException {
|
||||
return com.google.protobuf.GeneratedMessage
|
||||
.parseDelimitedWithIOException(PARSER, input);
|
||||
}
|
||||
public static io.opentracing.contrib.HelloRequest parseDelimitedFrom(
|
||||
java.io.InputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws java.io.IOException {
|
||||
return com.google.protobuf.GeneratedMessage
|
||||
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
|
||||
}
|
||||
public static io.opentracing.contrib.HelloRequest parseFrom(
|
||||
com.google.protobuf.CodedInputStream input)
|
||||
throws java.io.IOException {
|
||||
return com.google.protobuf.GeneratedMessage
|
||||
.parseWithIOException(PARSER, input);
|
||||
}
|
||||
public static io.opentracing.contrib.HelloRequest parseFrom(
|
||||
com.google.protobuf.CodedInputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws java.io.IOException {
|
||||
return com.google.protobuf.GeneratedMessage
|
||||
.parseWithIOException(PARSER, input, extensionRegistry);
|
||||
}
|
||||
|
||||
public Builder newBuilderForType() { return newBuilder(); }
|
||||
public static Builder newBuilder() {
|
||||
return DEFAULT_INSTANCE.toBuilder();
|
||||
}
|
||||
public static Builder newBuilder(io.opentracing.contrib.HelloRequest prototype) {
|
||||
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
|
||||
}
|
||||
public Builder toBuilder() {
|
||||
return this == DEFAULT_INSTANCE
|
||||
? new Builder() : new Builder().mergeFrom(this);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected Builder newBuilderForType(
|
||||
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
|
||||
Builder builder = new Builder(parent);
|
||||
return builder;
|
||||
}
|
||||
/**
|
||||
* <pre>
|
||||
* The request message containing the user's name.
|
||||
* </pre>
|
||||
*
|
||||
* Protobuf type {@code helloworld.HelloRequest}
|
||||
*/
|
||||
public static final class Builder extends
|
||||
com.google.protobuf.GeneratedMessage.Builder<Builder> implements
|
||||
// @@protoc_insertion_point(builder_implements:helloworld.HelloRequest)
|
||||
io.opentracing.contrib.HelloRequestOrBuilder {
|
||||
public static final com.google.protobuf.Descriptors.Descriptor
|
||||
getDescriptor() {
|
||||
return io.opentracing.contrib.HelloWorldProto.internal_static_helloworld_HelloRequest_descriptor;
|
||||
}
|
||||
|
||||
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
|
||||
internalGetFieldAccessorTable() {
|
||||
return io.opentracing.contrib.HelloWorldProto.internal_static_helloworld_HelloRequest_fieldAccessorTable
|
||||
.ensureFieldAccessorsInitialized(
|
||||
io.opentracing.contrib.HelloRequest.class, io.opentracing.contrib.HelloRequest.Builder.class);
|
||||
}
|
||||
|
||||
// Construct using io.opentracing.contrib.HelloRequest.newBuilder()
|
||||
private Builder() {
|
||||
maybeForceBuilderInitialization();
|
||||
}
|
||||
|
||||
private Builder(
|
||||
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
|
||||
super(parent);
|
||||
maybeForceBuilderInitialization();
|
||||
}
|
||||
private void maybeForceBuilderInitialization() {
|
||||
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
|
||||
}
|
||||
}
|
||||
public Builder clear() {
|
||||
super.clear();
|
||||
name_ = "";
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public com.google.protobuf.Descriptors.Descriptor
|
||||
getDescriptorForType() {
|
||||
return io.opentracing.contrib.HelloWorldProto.internal_static_helloworld_HelloRequest_descriptor;
|
||||
}
|
||||
|
||||
public io.opentracing.contrib.HelloRequest getDefaultInstanceForType() {
|
||||
return io.opentracing.contrib.HelloRequest.getDefaultInstance();
|
||||
}
|
||||
|
||||
public io.opentracing.contrib.HelloRequest build() {
|
||||
io.opentracing.contrib.HelloRequest result = buildPartial();
|
||||
if (!result.isInitialized()) {
|
||||
throw newUninitializedMessageException(result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public io.opentracing.contrib.HelloRequest buildPartial() {
|
||||
io.opentracing.contrib.HelloRequest result = new io.opentracing.contrib.HelloRequest(this);
|
||||
result.name_ = name_;
|
||||
onBuilt();
|
||||
return result;
|
||||
}
|
||||
|
||||
public Builder mergeFrom(com.google.protobuf.Message other) {
|
||||
if (other instanceof io.opentracing.contrib.HelloRequest) {
|
||||
return mergeFrom((io.opentracing.contrib.HelloRequest)other);
|
||||
} else {
|
||||
super.mergeFrom(other);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public Builder mergeFrom(io.opentracing.contrib.HelloRequest other) {
|
||||
if (other == io.opentracing.contrib.HelloRequest.getDefaultInstance()) return this;
|
||||
if (!other.getName().isEmpty()) {
|
||||
name_ = other.name_;
|
||||
onChanged();
|
||||
}
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
|
||||
public final boolean isInitialized() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public Builder mergeFrom(
|
||||
com.google.protobuf.CodedInputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws java.io.IOException {
|
||||
io.opentracing.contrib.HelloRequest parsedMessage = null;
|
||||
try {
|
||||
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
|
||||
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
|
||||
parsedMessage = (io.opentracing.contrib.HelloRequest) e.getUnfinishedMessage();
|
||||
throw e.unwrapIOException();
|
||||
} finally {
|
||||
if (parsedMessage != null) {
|
||||
mergeFrom(parsedMessage);
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
private java.lang.Object name_ = "";
|
||||
/**
|
||||
* <code>optional string name = 1;</code>
|
||||
*/
|
||||
public java.lang.String getName() {
|
||||
java.lang.Object ref = name_;
|
||||
if (!(ref instanceof java.lang.String)) {
|
||||
com.google.protobuf.ByteString bs =
|
||||
(com.google.protobuf.ByteString) ref;
|
||||
java.lang.String s = bs.toStringUtf8();
|
||||
name_ = s;
|
||||
return s;
|
||||
} else {
|
||||
return (java.lang.String) ref;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>optional string name = 1;</code>
|
||||
*/
|
||||
public com.google.protobuf.ByteString
|
||||
getNameBytes() {
|
||||
java.lang.Object ref = name_;
|
||||
if (ref instanceof String) {
|
||||
com.google.protobuf.ByteString b =
|
||||
com.google.protobuf.ByteString.copyFromUtf8(
|
||||
(java.lang.String) ref);
|
||||
name_ = b;
|
||||
return b;
|
||||
} else {
|
||||
return (com.google.protobuf.ByteString) ref;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>optional string name = 1;</code>
|
||||
*/
|
||||
public Builder setName(
|
||||
java.lang.String value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
|
||||
name_ = value;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional string name = 1;</code>
|
||||
*/
|
||||
public Builder clearName() {
|
||||
|
||||
name_ = getDefaultInstance().getName();
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional string name = 1;</code>
|
||||
*/
|
||||
public Builder setNameBytes(
|
||||
com.google.protobuf.ByteString value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
checkByteStringIsUtf8(value);
|
||||
|
||||
name_ = value;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
public final Builder setUnknownFields(
|
||||
final com.google.protobuf.UnknownFieldSet unknownFields) {
|
||||
return this;
|
||||
}
|
||||
|
||||
public final Builder mergeUnknownFields(
|
||||
final com.google.protobuf.UnknownFieldSet unknownFields) {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
// @@protoc_insertion_point(builder_scope:helloworld.HelloRequest)
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(class_scope:helloworld.HelloRequest)
|
||||
private static final io.opentracing.contrib.HelloRequest DEFAULT_INSTANCE;
|
||||
static {
|
||||
DEFAULT_INSTANCE = new io.opentracing.contrib.HelloRequest();
|
||||
}
|
||||
|
||||
public static io.opentracing.contrib.HelloRequest getDefaultInstance() {
|
||||
return DEFAULT_INSTANCE;
|
||||
}
|
||||
|
||||
private static final com.google.protobuf.Parser<HelloRequest>
|
||||
PARSER = new com.google.protobuf.AbstractParser<HelloRequest>() {
|
||||
public HelloRequest parsePartialFrom(
|
||||
com.google.protobuf.CodedInputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return new HelloRequest(input, extensionRegistry);
|
||||
}
|
||||
};
|
||||
|
||||
public static com.google.protobuf.Parser<HelloRequest> parser() {
|
||||
return PARSER;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public com.google.protobuf.Parser<HelloRequest> getParserForType() {
|
||||
return PARSER;
|
||||
}
|
||||
|
||||
public io.opentracing.contrib.HelloRequest getDefaultInstanceForType() {
|
||||
return DEFAULT_INSTANCE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
19
vendor/github.com/grpc-ecosystem/grpc-opentracing/java/src/testgen/io/opentracing/contrib/HelloRequestOrBuilder.java
generated
vendored
Normal file
19
vendor/github.com/grpc-ecosystem/grpc-opentracing/java/src/testgen/io/opentracing/contrib/HelloRequestOrBuilder.java
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: helloworld.proto
|
||||
|
||||
package io.opentracing.contrib;
|
||||
|
||||
public interface HelloRequestOrBuilder extends
|
||||
// @@protoc_insertion_point(interface_extends:helloworld.HelloRequest)
|
||||
com.google.protobuf.MessageOrBuilder {
|
||||
|
||||
/**
|
||||
* <code>optional string name = 1;</code>
|
||||
*/
|
||||
java.lang.String getName();
|
||||
/**
|
||||
* <code>optional string name = 1;</code>
|
||||
*/
|
||||
com.google.protobuf.ByteString
|
||||
getNameBytes();
|
||||
}
|
||||
64
vendor/github.com/grpc-ecosystem/grpc-opentracing/java/src/testgen/io/opentracing/contrib/HelloWorldProto.java
generated
vendored
Normal file
64
vendor/github.com/grpc-ecosystem/grpc-opentracing/java/src/testgen/io/opentracing/contrib/HelloWorldProto.java
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: helloworld.proto
|
||||
|
||||
package io.opentracing.contrib;
|
||||
|
||||
public final class HelloWorldProto {
|
||||
private HelloWorldProto() {}
|
||||
public static void registerAllExtensions(
|
||||
com.google.protobuf.ExtensionRegistry registry) {
|
||||
}
|
||||
static final com.google.protobuf.Descriptors.Descriptor
|
||||
internal_static_helloworld_HelloRequest_descriptor;
|
||||
static final
|
||||
com.google.protobuf.GeneratedMessage.FieldAccessorTable
|
||||
internal_static_helloworld_HelloRequest_fieldAccessorTable;
|
||||
static final com.google.protobuf.Descriptors.Descriptor
|
||||
internal_static_helloworld_HelloReply_descriptor;
|
||||
static final
|
||||
com.google.protobuf.GeneratedMessage.FieldAccessorTable
|
||||
internal_static_helloworld_HelloReply_fieldAccessorTable;
|
||||
|
||||
public static com.google.protobuf.Descriptors.FileDescriptor
|
||||
getDescriptor() {
|
||||
return descriptor;
|
||||
}
|
||||
private static com.google.protobuf.Descriptors.FileDescriptor
|
||||
descriptor;
|
||||
static {
|
||||
java.lang.String[] descriptorData = {
|
||||
"\n\020helloworld.proto\022\nhelloworld\"\034\n\014HelloR" +
|
||||
"equest\022\014\n\004name\030\001 \001(\t\"\035\n\nHelloReply\022\017\n\007me" +
|
||||
"ssage\030\001 \001(\t2I\n\007Greeter\022>\n\010SayHello\022\030.hel" +
|
||||
"loworld.HelloRequest\032\026.helloworld.HelloR" +
|
||||
"eply\"\000B6\n\033io.grpc.examples.helloworldB\017H" +
|
||||
"elloWorldProtoP\001\242\002\003HLWb\006proto3"
|
||||
};
|
||||
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
|
||||
new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
|
||||
public com.google.protobuf.ExtensionRegistry assignDescriptors(
|
||||
com.google.protobuf.Descriptors.FileDescriptor root) {
|
||||
descriptor = root;
|
||||
return null;
|
||||
}
|
||||
};
|
||||
com.google.protobuf.Descriptors.FileDescriptor
|
||||
.internalBuildGeneratedFileFrom(descriptorData,
|
||||
new com.google.protobuf.Descriptors.FileDescriptor[] {
|
||||
}, assigner);
|
||||
internal_static_helloworld_HelloRequest_descriptor =
|
||||
getDescriptor().getMessageTypes().get(0);
|
||||
internal_static_helloworld_HelloRequest_fieldAccessorTable = new
|
||||
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
|
||||
internal_static_helloworld_HelloRequest_descriptor,
|
||||
new java.lang.String[] { "Name", });
|
||||
internal_static_helloworld_HelloReply_descriptor =
|
||||
getDescriptor().getMessageTypes().get(1);
|
||||
internal_static_helloworld_HelloReply_fieldAccessorTable = new
|
||||
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
|
||||
internal_static_helloworld_HelloReply_descriptor,
|
||||
new java.lang.String[] { "Message", });
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(outer_class_scope)
|
||||
}
|
||||
1
vendor/github.com/grpc-ecosystem/grpc-opentracing/java/src/testgen/io/opentracing/contrib/README.md
generated
vendored
Normal file
1
vendor/github.com/grpc-ecosystem/grpc-opentracing/java/src/testgen/io/opentracing/contrib/README.md
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
These are protobuf-generated classes to be used for testing purposes only.
|
||||
Reference in New Issue
Block a user