Am I right in assuming that one of the primary objectives of openTracing is to make instrumentation of traces within application code agnostic to the specific tracer being used? In other words, I should be able to swap out Jaeger or Zipkin for Elastic APM without any required code changes (other than imports).
Yes, that's the idea behind the API. There is one part that you'll need to change in your application: constructing the Tracer object. In this example, that would be the tracer value that's passed into new Hello(tracer). More concretely:
remove import io.jaegertracing.internal.JaegerTracer; (it's not needed anyway)
So there are some changes required, but note that it's restricted to initialising the Tracer. After that, the instrumentation code is all the same: i.e. the calls to tracer inside Hello.sayHello in the example.
Is Tracing.startServerSpan an OpenTracing API?
In any case, your imports are not included in this code snippet, but assuming the tracer here is of type io.opentracing.Tracer, you wouldn't need to change anything in this specific code, as long as you make sure that tracer you are using here is an instance of co.elastic.apm.opentracing.ElasticApmTracer, as @axw instructed above.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.