Hi All,
I really think that supporting
opentracing.io compliant Tracers in
microprofile.io will be a big benefit for developers and particularly for operators in microservice environments.
Moving forward to agree on a specification for opentracing in
microprofile.io, we need to resolve some issues.
The current spec proposes the following API:
@Trace
@Notrace
The ability to inject an io.opentracing.Tracer.
The current spec also proposes some non-API requirements, which are at least as important. See
https://github.com/eclipse/microprofile-opentracing/blob/master/spec/src/main/asciidoc/microprofile-opentracing-spec.asciidoc Since last time we discussed this here, there have been some developments.
At
https://github.com/opentracing-contrib/java-jaxrs:
I believe the API implemented is:
@Traced(operationName=<override of operation name>) -- only used to change span name from default, all server entry points will be traced
Access to the io.opentracing.Tracer is through utility io.opentracing.util.GlobalTracer.get().
You can inject an io.opentracing.contrib.jaxrs2.server.TracingContext through @BeanParam TracingContext
TracingContext allows access to a SpanContext stored in an incoming request attribute.
Container and Client request/response filters are provided that will automatically trace incoming and outgoing requests if configured correctly.
Tracing can be disabled for outgoing requests by adding .property(TracingProperties.TRACING_DISABLED, true) when the request is made.
I don't see a way to disable tracing of incoming requests.
Default Span name for incoming request is: requestContext.getMethod()
Default Span name for outgoing request is: requestContext.getMethod()
Tags on all incoming requests are at least: (Tags.SPAN_KIND.getKey(), Tags.SPAN_KIND_SERVER)
Tags on all outgoing requests are at least: (Tags.SPAN_KIND.getKey(), Tags.SPAN_KIND_CLIENT)
Requires developers to explicitly add some code to their applications.
At
https://cwiki.apache.org/confluence/display/CXF20DOC/Using+OpenTracing I believe the API implemented is:
No annotations that I could see.
Access to the io.opentracing.Tracer is through utility io.opentracing.util.GlobalTracer.get()
You can inject an org.apache.cxf.tracing.TracerContext through @Context annotation
TracerContext allows access to Span operations
Container and Client request/response filters are provided that will automatically trace incoming and outgoing requests if configured correctly.
I don't see a way to disable tracing of incoming requests or outgoing requests.
Span name for incoming request is: requestContext.getMethod() requestContext.getUriInfo().getRequestUri()
Span name for outgoing request is: requestContext.getMethod() requestContext.getUriInfo().getRequestUri()
Tags on all incoming requests are at least: (Tags.HTTP_METHOD.getKey(), method),(Tags.HTTP_URL.getKey(), uri.toString()),(Tags.HTTP_STATUS.getKey(), responseStatus)
Tags on all outgoing requests are at least: (Tags.HTTP_METHOD.getKey(), method),(Tags.HTTP_URL.getKey(), uri.toString()),(Tags.HTTP_STATUS.getKey(), responseStatus)
Support for JAX-WS is also provided.
Requires developers to explicitly add some code to their applications.
I think the
microprofile.io spec should be basically as follows:
Access to the io.opentracing.Tracer is through @Inject io.opentracing.Tracer
@Trace becomes @Traced -- might as well make it match the io.opentracing JAX-RS project.
@Traced(value="true", operationName=<override of operation name>)
I think we need to be able to turn off tracing for some methods that would be traced by default.
I propose @Trace(false) instead of @Notrace. I think I saw this option in something by Pavol Loffay, but I can't find the reference now.
Need to specify a way to disable tracing for outgoing requests. Only way I have seen so far is by adding .property(TracingProperties.TRACING_DISABLED, true). I can't think of a way to accomplish this with an annotation.
I propose specifying default Span names and tags as:
Default Span name for incoming request is: requestContext.getMethod() requestContext.getUriInfo().getRequestUri()
Default Span name for outgoing request is: requestContext.getMethod() requestContext.getUriInfo().getRequestUri()
Tags on all incoming requests are at least: (Tags.SPAN_KIND, Tags.HTTP_METHOD, Tags.HTTP_URL, Tags.HTTP_STATUS, Tags.ERROR if true)
Tags on all outgoing requests are at least: (Tags.SPAN_KIND, Tags.HTTP_METHOD, Tags.HTTP_URL, Tags.HTTP_STATUS, Tags.ERROR if true)
Also, the spec will make it clear that developers will not be required to add any code to their applications to get basic distributed tracing support of inbound and outbound requests.
I'll make the changes to the spec and API's and we can continue to move this proposal along.
Steve