OpenTracing
Instana provides the flexibility on how to capture traces. Regardless of its origin, every trace is treated equally. If you require greater control and flexibility of what exactly gets traced, OpenTracing, a vendor-neutral API for tracing applications, is an option for you.
Instana supports OpenTracing as defined in the OpenTracing specification for the following languages:
Technology | Details |
---|---|
Crystal | Link |
Go | Link |
Java | Link |
Node.js | Link |
PHP | Link |
Python | Link |
Ruby | Link |
In most cases, OpenTracing and other tracing strategies are independent of each other. Although you can use each simultaneously and independently, the strategies themselves cannot be combined to contribute to individual traces. The exceptions, in this case, are Python and GoLang, where OpenTracing doubles as the Instana AutoTrace SDK.
Example - tracing Node.js applications
The following example shows how to use Instana OpenTracing for Node.js applications:
const instana = require('@instana/collector');
// Always initialize the sensor as the first module inside the application.
instana({
tracing: {
enabled: true
}
});
const opentracing = require('opentracing');
// optionally use the opentracing provided singleton tracer wrapper
opentracing.initGlobalTracer(instana.opentracing.createTracer());
// retrieve the tracer instance from the opentracing tracer wrapper
const tracer = opentracing.globalTracer();
// start a new trace with an operation name
const span = tracer.startSpan('auth');
// mark operation as failed
span.setTag(opentracing.Tags.ERROR, true);
// finish the span and schedule it for transmission to instana
span.finish();
OpenTracing best practices
When OpenTracing is used, see the following OpenTracing best practices to fully utilize your Instana dashboard.
For important steps agnostic to a tracing strategy, see our custom tracing best practices docs.
peer.service is optional
Set the peer.service
tag if you don't know the remote side is instrumented. In general, it is not required as long as the remote side is monitored by Instana and in that case, it will automatically have a service name set. If
peer.service
is set in the client call and the server is instrumented and has a custom service name, the results are undefined.
Additional information
See the OpenTracing portal for more explanations, quick start guides and more.