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 | For more information, see Monitoring Crystal |
Go | For more information, see Monitoring Go |
Java | For more information, see Java Trace SDK |
Node.js | For more information, see Instana Node.js API |
PHP | For more information, see Monitoring PHP |
Python | For more information, see Supports Instana Python 2.5.3 and earlier |
Ruby | For more information, see Ruby Tracing SDK |
Usually, 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 you use OpenTracing, you can see the following OpenTracing best practices to fully use your Instana dashboard. For important steps agnostic to a tracing strategy, see our custom tracing best practices docs.
peer.service is optional
You must set the peer.service
tag if you don't know that the remote side is instrumented. In general, you do not need to set the peer.service
tag if Instana monitors the remote side. In this case, a service name is
set automatically. If peer.service
is set in the client call and the server is instrumented and has a custom service name, the results are undefined.
For more information, see the OpenTracing portal.