mirror of
https://github.com/coredns/coredns.git
synced 2026-04-25 21:35:33 -04:00
update deps (#686)
This commit is contained in:
7
vendor/github.com/grpc-ecosystem/grpc-opentracing/java/.gitignore
generated
vendored
7
vendor/github.com/grpc-ecosystem/grpc-opentracing/java/.gitignore
generated
vendored
@@ -1,7 +0,0 @@
|
||||
build/*
|
||||
.gradle/*
|
||||
gradle.properties
|
||||
.classpath
|
||||
.project
|
||||
.settings/*
|
||||
bin/
|
||||
319
vendor/github.com/grpc-ecosystem/grpc-opentracing/java/README.rst
generated
vendored
319
vendor/github.com/grpc-ecosystem/grpc-opentracing/java/README.rst
generated
vendored
@@ -1,319 +0,0 @@
|
||||
#####################
|
||||
GRPC-Java OpenTracing
|
||||
#####################
|
||||
|
||||
============
|
||||
Installation
|
||||
============
|
||||
|
||||
This package is available on Maven Central and can be added to your project as follows:
|
||||
|
||||
**Maven**
|
||||
|
||||
.. code-block::
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.opentracing.contrib</groupId>
|
||||
<artifactId>grpc-opentracing</artifactId>
|
||||
<version>0.2.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
**Gradle**
|
||||
|
||||
.. code-block::
|
||||
|
||||
compile 'io.opentracing.contrib:grpc-opentracing:0.2.0'
|
||||
|
||||
==========
|
||||
Quickstart
|
||||
==========
|
||||
|
||||
If you want to add basic tracing to your clients and servers, you can do so in a few short and simple steps, as shown below. (These code snippets use the grpc example's ``GreeterGrpc``, generated by protocol buffers.)
|
||||
|
||||
**Servers**
|
||||
|
||||
- Instantiate a tracer
|
||||
- Create a ``ServerTracingInterceptor``
|
||||
- Intercept a service
|
||||
- (Optional) Access the `current span`_
|
||||
|
||||
.. _current span: `Current Span Context`_
|
||||
|
||||
.. code-block:: java
|
||||
|
||||
import io.opentracing.Tracer;
|
||||
|
||||
public class YourServer {
|
||||
|
||||
private int port;
|
||||
private Server server;
|
||||
// Any io.opentracing.Tracer implementation will do here. For instance,
|
||||
// https://github.com/uber/jaeger-client-java/blob/master/jaeger-core/src/main/java/com/uber/jaeger/Tracer.java
|
||||
// generates Zipkin-compatible data.
|
||||
private final Tracer tracer;
|
||||
|
||||
private void start() throws IOException {
|
||||
ServerTracingInterceptor tracingInterceptor = new ServerTracingInterceptor(this.tracer);
|
||||
|
||||
server = ServerBuilder.forPort(port)
|
||||
.addService(tracingInterceptor.intercept(someServiceDef))
|
||||
.build()
|
||||
.start();
|
||||
}
|
||||
}
|
||||
|
||||
**Clients**
|
||||
|
||||
- Instantiate a tracer
|
||||
- Create a ``ClientTracingInterceptor``
|
||||
- Intercept the client channel
|
||||
|
||||
.. code-block:: java
|
||||
|
||||
import io.opentracing.Tracer;
|
||||
|
||||
public class YourClient {
|
||||
|
||||
private final ManagedChannel channel;
|
||||
private final GreeterGrpc.GreeterBlockingStub blockingStub;
|
||||
// Any io.opentracing.Tracer implementation will do here. For instance,
|
||||
// https://github.com/uber/jaeger-client-java/blob/master/jaeger-core/src/main/java/com/uber/jaeger/Tracer.java
|
||||
// generates Zipkin-compatible data.
|
||||
private final Tracer tracer;
|
||||
|
||||
public YourClient(String host, int port) {
|
||||
|
||||
channel = ManagedChannelBuilder.forAddress(host, port)
|
||||
.usePlaintext(true)
|
||||
.build();
|
||||
|
||||
ClientTracingInterceptor tracingInterceptor = new ClientTracingInterceptor(this.tracer)
|
||||
|
||||
blockingStub = GreeterGrpc.newBlockingStub(tracingInterceptor.intercept(channel));
|
||||
}
|
||||
}
|
||||
|
||||
There's an example of a simple traced client (`TracedClient`) and server (`TracedService`) in `src/test`.
|
||||
|
||||
==============
|
||||
Server Tracing
|
||||
==============
|
||||
|
||||
A ``ServerTracingInterceptor`` uses default settings, which you can override by creating it using a ``ServerTracingInterceptor.Builder``.
|
||||
|
||||
- ``withOperationName(OperationNameConstructor constructor)``: Define how the operation name is constructed for all spans created for the intercepted service. Default sets the operation name as the name of the RPC method. More details in the `Operation Name`_ section.
|
||||
- ``withStreaming()``: Logs to the server span whenever a message is received. *Note:* This package supports streaming but has not been rigorously tested. If you come across any issues, please let us know.
|
||||
- ``withVerbosity()``: Logs to the server span additional events, such as message received, half close (client finished sending messages), and call complete. Default only logs if a call is cancelled.
|
||||
- ``withTracedAttributes(ServerRequestAttribute... attrs)``: Sets tags on the server span in case you want to track information about the RPC call. See ServerRequestAttribute.java for a list of traceable request attributes.
|
||||
|
||||
**Example**:
|
||||
|
||||
.. code-block:: java
|
||||
|
||||
ServerTracingInterceptor tracingInterceptor = new ServerTracingInterceptor
|
||||
.Builder(tracer)
|
||||
.withStreaming()
|
||||
.withVerbosity()
|
||||
.withOperationName(new OperationNameConstructor() {
|
||||
@Override
|
||||
public <ReqT, RespT> String constructOperationName(MethodDescriptor<ReqT, RespT> method) {
|
||||
// construct some operation name from the method descriptor
|
||||
}
|
||||
})
|
||||
.withTracedAttributes(ServerRequestAttribute.HEADERS,
|
||||
ServerRequestAttribute.METHOD_TYPE)
|
||||
.build();
|
||||
|
||||
==============
|
||||
Client Tracing
|
||||
==============
|
||||
|
||||
A ``ClientTracingInterceptor`` also has default settings, which you can override by creating it using a ``ServerTracingInterceptor.Builder``.
|
||||
|
||||
- ``withOperationName(String operationName)``: Define how the operation name is constructed for all spans created for this intercepted client. Default is the name of the RPC method. More details in the `Operation Name`_ section.
|
||||
- ``withActiveSpanSource(ActiveSpanSource activeSpanSource)``: Define how to extract the current active span, if any. This is needed if you want your client to continue a trace instead of starting a new one. More details in the `Active Span Source`_ section.
|
||||
- ``withStreaming()``: Logs to the client span whenever a message is sent or a response is received. *Note:* This package supports streaming but has not been rigorously tested. If you come across any issues, please let us know.
|
||||
- ``withVerbosity()``: Logs to the client span additional events, such as call started, message sent, half close (client finished sending messages), response received, and call complete. Default only logs if a call is cancelled.
|
||||
- ``withTracedAttributes(ClientRequestAttribute... attrs)``: Sets tags on the client span in case you want to track information about the RPC call. See ClientRequestAttribute.java for a list of traceable request attributes.
|
||||
|
||||
**Example**:
|
||||
|
||||
.. code-block:: java
|
||||
|
||||
import io.opentracing.Span;
|
||||
|
||||
ClientTracingInterceptor tracingInterceptor = new ClientTracingInterceptor
|
||||
.Builder(tracer)
|
||||
.withStreaming()
|
||||
.withVerbosity()
|
||||
.withOperationName(new OperationNameConstructor() {
|
||||
@Override
|
||||
public <ReqT, RespT> String constructOperationName(MethodDescriptor<ReqT, RespT> method) {
|
||||
// construct some operation name from the method descriptor
|
||||
}
|
||||
})
|
||||
.withActiveSpanSource(new ActiveSpanSource() {
|
||||
@Override
|
||||
public Span getActiveSpan() {
|
||||
// implement how to get the current active span, for example:
|
||||
return OpenTracingContextKey.activeSpan();
|
||||
}
|
||||
})
|
||||
.withTracingAttributes(ClientRequestAttribute.ALL_CALL_OPTIONS,
|
||||
ClientRequestAttribute.HEADERS)
|
||||
.build();
|
||||
|
||||
.. _Operation Name: `Operation Names`_
|
||||
.. _Active Span Source: `Active Span Sources`_
|
||||
|
||||
====================
|
||||
Current Span Context
|
||||
====================
|
||||
|
||||
In your server request handler, you can access the current active span for that request by calling
|
||||
|
||||
.. code-block:: java
|
||||
|
||||
Span span = OpenTracingContextKey.activeSpan();
|
||||
|
||||
This is useful if you want to manually set tags on the span, log important events, or create a new child span for internal units of work. You can also use this key to wrap these internal units of work with a new context that has a user-defined active span.
|
||||
|
||||
For example:
|
||||
|
||||
.. code-block:: java
|
||||
|
||||
Tracer tracer = ...;
|
||||
|
||||
// some unit of internal work that you want to trace
|
||||
Runnable internalWork = someInternalWork
|
||||
|
||||
// a wrapper that traces the work of the runnable
|
||||
class TracedRunnable implements Runnable {
|
||||
Runnable work;
|
||||
Tracer tracer;
|
||||
|
||||
TracedRunnable(Runnable work, Tracer tracer) {
|
||||
this.work = work;
|
||||
this.tracer = tracer;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
|
||||
// create a child span for the current active span
|
||||
Span span = tracer
|
||||
.buildSpan("internal-work")
|
||||
.asChildOf(OpenTracingContextKey.activeSpan())
|
||||
.start();
|
||||
|
||||
// create a new context with the child span as the active span
|
||||
Context contextWithNewSpan = Context.current()
|
||||
.withValue(OpenTracingContextKey.get(), span);
|
||||
|
||||
// wrap the original work and run it
|
||||
Runnable tracedWork = contextWithNewSpan.wrap(this.work);
|
||||
tracedWork.run();
|
||||
|
||||
// make sure to finish any manually created spans!
|
||||
span.finish();
|
||||
}
|
||||
}
|
||||
|
||||
Runnable tracedInternalWork = new TracedRunnable(internalWork, tracer);
|
||||
tracedInternalWork.run();
|
||||
|
||||
===============
|
||||
Operation Names
|
||||
===============
|
||||
|
||||
The default operation name for any span is the RPC method name (``io.grpc.MethodDescriptor.getFullMethodName()``). However, you may want to add your own prefixes, alter the name, or define a new name. For examples of good operation names, check out the OpenTracing `semantics`_.
|
||||
|
||||
To alter the operation name, you need to add an implementation of the interface ``OperationNameConstructor`` to the ``ClientTracingInterceptor.Builder`` or ``ServerTracingInterceptor.Builder``. For example, if you want to add a prefix to the default operation name of your ClientInterceptor, your code would look like this:
|
||||
|
||||
.. code-block:: java
|
||||
|
||||
ClientTracingInterceptor interceptor = ClientTracingInterceptor.Builder ...
|
||||
.withOperationName(new OperationNameConstructor() {
|
||||
@Override
|
||||
public <ReqT, RespT> String constructOperationName(MethodDescriptor<ReqT, RespT> method) {
|
||||
return "your-prefix" + method.getFullMethodName();
|
||||
}
|
||||
})
|
||||
.with....
|
||||
.build()
|
||||
|
||||
.. _semantics: http://opentracing.io/spec/#operation-names
|
||||
|
||||
===================
|
||||
Active Span Sources
|
||||
===================
|
||||
|
||||
If you want your client to continue a trace rather than starting a new one, then you can tell your ``ClientTracingInterceptor`` how to extract the current active span by building it with your own implementation of the interface ``ActiveSpanSource``. This interface has one method, ``getActiveSpan``, in which you will define how to access the current active span.
|
||||
|
||||
For example, if you're creating the client in an environment that has the active span stored in a global dictionary-style context under ``OPENTRACING_SPAN_KEY``, then you could configure your Interceptor as follows:
|
||||
|
||||
.. code-block:: java
|
||||
|
||||
import io.opentracing.Span;
|
||||
|
||||
ClientTracingInterceptor interceptor = new ClientTracingInterceptor
|
||||
.Builder(tracer)
|
||||
...
|
||||
.withActiveSpanSource(new ActiveSpanSource() {
|
||||
@Override
|
||||
public Span getActiveSpan() {
|
||||
return Context.get(OPENTRACING_SPAN_KEY);
|
||||
}
|
||||
})
|
||||
...
|
||||
.build();
|
||||
|
||||
We also provide two built-in implementations:
|
||||
|
||||
* ``ActiveSpanSource.GRPC_CONTEXT`` uses the current ``io.grpc.Context`` and returns the active span for ``OpenTracingContextKey``. This is the default active span source.
|
||||
* ``ActiveSpanSource.NONE`` always returns null as the active span, which means the client will always start a new trace
|
||||
|
||||
===================================
|
||||
Integrating with Other Interceptors
|
||||
===================================
|
||||
|
||||
Although we provide ``ServerTracingInterceptor.intercept(service)`` and ``ClientTracingInterceptor.intercept(channel)`` methods, you don't want to use these if you're chaining multiple interceptors. Instead, use the following code (preferably putting the tracing interceptor at the top of the interceptor stack so that it traces the entire request lifecycle, including other interceptors):
|
||||
|
||||
**Servers**
|
||||
|
||||
.. code-block:: java
|
||||
|
||||
server = ServerBuilder.forPort(port)
|
||||
.addService(ServerInterceptors.intercept(service, someInterceptor,
|
||||
someOtherInterceptor, serverTracingInterceptor))
|
||||
.build()
|
||||
.start();
|
||||
|
||||
**Clients**
|
||||
|
||||
.. code-block:: java
|
||||
|
||||
blockingStub = GreeterGrpc.newBlockingStub(ClientInterceptors.intercept(channel,
|
||||
someInterceptor, someOtherInterceptor, clientTracingInterceptor));
|
||||
|
||||
======================
|
||||
Releasing new versions
|
||||
======================
|
||||
|
||||
Create a gradle.properties in this directory. It should look approximately like this:
|
||||
|
||||
.. code-block::
|
||||
|
||||
sonatypeUsername=bensigelman
|
||||
sonatypePassword=<your OSSRH sonatype password>
|
||||
signing.keyId=<`gpg --list-keys` output, minus the prefix like "2048R/">
|
||||
signing.password=<your gpg password>
|
||||
signing.secretKeyRingFile=/Your/Homedir/.gnupg/secring.gpg
|
||||
|
||||
Then run:
|
||||
|
||||
.. code-block::
|
||||
|
||||
$ gradle uploadArchives closeAndPromoteRepository
|
||||
|
||||
121
vendor/github.com/grpc-ecosystem/grpc-opentracing/java/build.gradle
generated
vendored
121
vendor/github.com/grpc-ecosystem/grpc-opentracing/java/build.gradle
generated
vendored
@@ -1,121 +0,0 @@
|
||||
description = "grpc-java: OpenTracing"
|
||||
|
||||
group = "io.opentracing.contrib"
|
||||
version = '0.2.0'
|
||||
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'maven'
|
||||
apply plugin: 'signing'
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
java {
|
||||
srcDirs = ['src/main/java']
|
||||
}
|
||||
}
|
||||
test {
|
||||
java {
|
||||
srcDirs = ['src/test/java', 'src/testgen']
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task javadocJar(type: Jar) {
|
||||
classifier = 'javadoc'
|
||||
from javadoc
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar) {
|
||||
classifier = 'sources'
|
||||
from sourceSets.main.allSource
|
||||
}
|
||||
|
||||
artifacts {
|
||||
archives jar
|
||||
|
||||
archives javadocJar
|
||||
archives sourcesJar
|
||||
}
|
||||
|
||||
signing {
|
||||
sign configurations.archives
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
jar {
|
||||
baseName 'grpc-opentracing'
|
||||
version = '0.2.0'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile 'io.grpc:grpc-core:1.1.2'
|
||||
compile 'io.opentracing:opentracing-api:0.15.0'
|
||||
testCompile 'io.opentracing:opentracing-mock:0.15.0'
|
||||
testCompile 'io.grpc:grpc-protobuf:1.1.2'
|
||||
testCompile 'io.grpc:grpc-netty:1.1.2'
|
||||
testCompile 'io.grpc:grpc-stub:1.1.2'
|
||||
testCompile 'junit:junit:4.12'
|
||||
}
|
||||
|
||||
// Allow for automatic promotion and release to Maven Central
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.5.3"
|
||||
}
|
||||
}
|
||||
apply plugin: 'io.codearte.nexus-staging'
|
||||
|
||||
nexusStaging {
|
||||
packageGroup = "io.opentracing"
|
||||
}
|
||||
|
||||
uploadArchives {
|
||||
repositories {
|
||||
mavenDeployer {
|
||||
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
|
||||
|
||||
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
|
||||
authentication(userName: sonatypeUsername, password: sonatypePassword)
|
||||
}
|
||||
|
||||
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
|
||||
authentication(userName: sonatypeUsername, password: sonatypePassword)
|
||||
}
|
||||
|
||||
pom.project {
|
||||
name 'grpc-opentracing'
|
||||
packaging 'jar'
|
||||
// optionally artifactId can be defined here
|
||||
description 'Provides support for integrating OpenTracing in grpc clients and servers.'
|
||||
url 'http://www.github.com/grpc-ecosystem/grpc-opentracing'
|
||||
|
||||
scm {
|
||||
url 'scm:git@github.com:grpc-ecosystem:grpc-opentracing.git'
|
||||
connection 'scm:git@github.com:grpc-ecosystem/grpc-opentracing.git'
|
||||
developerConnection 'scm:git@github.com:grpc-ecosystem/grpc-opentracing.git'
|
||||
}
|
||||
|
||||
licenses {
|
||||
license {
|
||||
name 'BSD-3'
|
||||
url 'https://opensource.org/licenses/BSD-3-Clause'
|
||||
}
|
||||
}
|
||||
|
||||
developers {
|
||||
developer {
|
||||
name 'Kathy Camenzind'
|
||||
email 'kcamenzind@lightstep.com'
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
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();
|
||||
}
|
||||
@@ -1,312 +0,0 @@
|
||||
package io.opentracing.contrib;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import io.grpc.CallOptions;
|
||||
import io.grpc.Channel;
|
||||
import io.grpc.ClientCall;
|
||||
import io.grpc.ClientInterceptor;
|
||||
import io.grpc.ClientInterceptors;
|
||||
import io.grpc.ForwardingClientCall;
|
||||
import io.grpc.ForwardingClientCallListener;
|
||||
import io.grpc.Metadata;
|
||||
import io.grpc.MethodDescriptor;
|
||||
import io.grpc.Status;
|
||||
import io.opentracing.Span;
|
||||
import io.opentracing.Tracer;
|
||||
import io.opentracing.propagation.Format;
|
||||
import io.opentracing.propagation.TextMap;
|
||||
|
||||
/**
|
||||
* 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 AFFINITY:
|
||||
if (callOptions.getAffinity() == null) {
|
||||
span.setTag("grpc.affinity", "null");
|
||||
} else {
|
||||
span.setTag("grpc.affinity", callOptions.getAffinity().toString());
|
||||
}
|
||||
break;
|
||||
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", null);
|
||||
}
|
||||
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("Response headers received", headers.toString()); }
|
||||
delegate().onHeaders(headers);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessage(RespT message) {
|
||||
if (streaming || verbose) { span.log("Response received", null); }
|
||||
delegate().onMessage(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClose(Status status, Metadata trailers) {
|
||||
if (verbose) {
|
||||
if (status.getCode().value() == 0) { span.log("Call closed", null); }
|
||||
else { span.log("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, null);
|
||||
} else {
|
||||
span.log(errorMessage, cause.getMessage());
|
||||
}
|
||||
delegate().cancel(message, cause);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void halfClose() {
|
||||
if (streaming) { span.log("Finished sending messages", null); }
|
||||
delegate().halfClose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMessage(ReqT message) {
|
||||
if (streaming || verbose) { span.log("Message sent", null); }
|
||||
delegate().sendMessage(message);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private Span createSpanFromParent(Span parentSpan, String operationName) {
|
||||
if (parentSpan == null) {
|
||||
return tracer.buildSpan(operationName).start();
|
||||
} else {
|
||||
return tracer.buildSpan(operationName).asChildOf(parentSpan).start();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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,
|
||||
AFFINITY,
|
||||
AUTHORITY,
|
||||
ALL_CALL_OPTIONS,
|
||||
HEADERS
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
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);
|
||||
}
|
||||
@@ -1,240 +0,0 @@
|
||||
package io.opentracing.contrib;
|
||||
|
||||
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("Message received", message); }
|
||||
delegate().onMessage(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHalfClose() {
|
||||
if (streaming) { span.log("Client finished sending messages", null); }
|
||||
delegate().onHalfClose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel() {
|
||||
span.log("Call cancelled", null);
|
||||
span.finish();
|
||||
delegate().onCancel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
if (verbose) { span.log("Call completed", null); }
|
||||
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).start();
|
||||
} else {
|
||||
span = tracer.buildSpan(operationName).asChildOf(parentSpanCtx).start();
|
||||
}
|
||||
} catch (IllegalArgumentException iae){
|
||||
span = tracer.buildSpan(operationName)
|
||||
.withTag("Error", "Extract failed and an IllegalArgumentException was thrown")
|
||||
.start();
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
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() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
## 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`.
|
||||
@@ -1,39 +0,0 @@
|
||||
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;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
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();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,384 +0,0 @@
|
||||
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);
|
||||
for(LogEntry entry : span.logEntries()) {
|
||||
System.out.println(entry.eventName());
|
||||
}
|
||||
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);
|
||||
for(LogEntry entry : span.logEntries()) {
|
||||
System.out.println(entry.eventName());
|
||||
}
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,251 +0,0 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -1,445 +0,0 @@
|
||||
// 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
// 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();
|
||||
}
|
||||
@@ -1,445 +0,0 @@
|
||||
// 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
// 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();
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
// 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 +0,0 @@
|
||||
These are protobuf-generated classes to be used for testing purposes only.
|
||||
Reference in New Issue
Block a user