OpenTracing

OpenTracing is an open and vendor neutral API for tracing, which enables users to avoid vendor lock-in, by allowing to switch the OpenTracing implementer at any time. It also enables developers of frameworks to provide tracing functionality in a standard fashion to enable better insights into framework behavior when using any OpenTracing implementation. Web-scale companies like Uber, Apple, and Yelp are using OpenTracing to get deeper visibility into their highly distributed and dynamic applications. The reason for using an SDK-based approach in favor of an agent based approach is that architects often want to have 100% control of what is traced to improve the feedback precision.

Instana needs high quality data in order to extract information about quality of service and application health by utilizing machine learning technologies. Therefore OpenTracing can be a high quality source of data, as developers normally know very well which data is useful to trace and analyze problem situations.

Our implementations can be found as open source on GitHub and can be easily used by following a few simple steps.

OpenTracing and Instana Built In Tracing

Instana strives to give customers flexibility on how traces are captured by our system. We treat any trace, regardless of its origin, equally. OpenTracing is an option for those customers who want higher control and flexibility of exactly what is traced. In fact, our automatic instrumentation is fully compatible with our OpenTracing implementation. Traces captured from our automatic instrumentation can be combined or enhanced with specific OpenTracing data. This allows customers to combine custom applications (where OpenTracing SDK can be used) with legacy and third party applications where adding custom trace code is impossible.

OpenTracing Example

The following example shows how to use Instana OpenTracing for NodeJs, where automatic instrumentation for express is combined with OpenTracing.

const instana = require('instana-nodejs-sensor');
instana({
  tracing: {
    enabled: true
  }
});

const opentracing = require('opentracing');
const express = require('express');

opentracing.initGlobalTracer(instana.opentracing.createTracer());
const tracer = opentracing.globalTracer();

const app = express();

app.get('/', (req, res) => {
  var spanContext = instana.opentracing.getCurrentlyActiveInstanaSpanContext();
  var authSpan = tracer.startSpan('auth', {childOf: spanContext});
  authSpan.finish();
  res.send('OK');
});

app.listen(3000, () => {
  console.log('Listening on port 3000');
});

When the above example is invoked from a browser, the trace in Instana automatically shows the incoming http request and the created OpenTracing child span. So both the automatic generated HTTP call, and the OpenTracing call, are correlated in the same Trace.

tracing 10

We think that this is a great example for adding additional data sources to Instana traces then visualized and analyzed in a consistent manner. In the same way, we collect and analyze metric data from DropWizard Metrics to support custom metrics by users. We will continue to add extensions for additional types of user defined data. All data, traces, and context are always added into our Dynamic Graph model for continuous analytics, understanding, and forecasting.

Other Examples

More OpenTracing examples for other supported languages are available in the Github repositories of the respective languages: