What Is OpenTracing, Why It Was Sunset, and How to Migrate

  • Topics

OpenTracing is a set of APIs and libraries that enables developers to integrate distributed tracing into their applications, providing visibility into the performance and behavior of complex, distributed systems. In 2019 it was deprecated and merged with OpenCensus to form OpenTelemetry.

Distributed tracing provides an end-to-end, causal, and latency-oriented view of a system. It enables developers to trace requests as they traverse through various services in an application, understanding the sequence of events, dependencies, and paths within the system. This is crucial in identifying bottlenecks and latency issues and diagnosing failures.

OpenTracing was proposed as an open standard for instrumentation, offering vendor-neutral APIs, allowing one to switch between different tracing systems without changing the instrumentation code. 

While some organizations still use OpenTracing, the project is now ” archived “. It is recommended to migrate from OpenTracing to OpenTelemetry, and we’ll explain how to do it further in this article.

Understanding OpenTracing Terminologies 

Tracer

The tracer is the component that creates the spans and understands how to record and report them. It is responsible for tracking the execution of a program and generating trace data. It hooks into the application, records the operations, and sends this information to a trace collector.

Each trace is made up of multiple spans, and it’s the tracer’s job to make sure these spans are created, context is managed, and the data is sent out correctly. The tracer provides methods to create and manage spans according to the OpenTracing specification.

Span

A span represents a logical unit of work in OpenTracing with an operation name, start time, and duration. A span could be as simple as a read from a database or as complex as a multi-step operation in a microservice. Each span is part of a trace and can have zero or more causal relationships to other spans.

Spans are the building blocks of a trace. They store the timing data for their operations, along with any relevant tags or logs. A span can have references to other spans, which allows for the construction of a graph that represents the execution flow of the application.

SpanContext

The SpanContext is the state that accompanies a span as it propagates throughout a system. It carries metadata from the span, like trace identifiers and trace-level flags. The SpanContext enables end-to-end trace continuity, even across process boundaries like distributed architectures. SpanContext is the ingredient that allows a trace to provide a coherent, complete picture of a transaction as it moves through a distributed system.

The SpanContext is not meant to be modified once created; it’s intended to be propagated and used as-is. It’s a crucial part of the OpenTracing specification as it ensures that trace context is propagated across process boundaries correctly.

References

References in OpenTracing are used to establish relationships between spans. There are two types of references:

  • A ChildOf reference means that the span depends on another span’s result or completion. It’s often used to represent parent-child relationships. 
  • A FollowsFrom reference represents a causal relationship but where the span does not depend on the completion of the parent span. This is often used in asynchronous operations where the parent span may complete before the child span.

Why Was OpenTracing Sunsetted? 

OpenTracing was sunsetted and merged with OpenCensus to form OpenTelemetry in 2019. The goal was to create a unified, comprehensive standard for distributed tracing and metrics. Both OpenTracing and OpenCensus were similar solutions aiming to solve the same problem—providing developers with a standardized method for capturing distributed traces and metrics.

However, having two separate projects led to fragmentation and confusion in the community. Many developers had to choose between the two or attempt to bridge them, which was not ideal. The decision to sunset OpenTracing and OpenCensus was made in favor of building one standard that would be more beneficial to the developer community.

OpenTelemetry, the successor of OpenTracing and OpenCensus, provides a single set of APIs, libraries, agents, and collector services to capture distributed traces and metrics. It’s built to be more flexible, extensible, and compatible with modern cloud-native software.

OpenTracing vs. OpenTelemetry 

OpenTracing was a notable project that set the foundation for standardized distributed tracing. However, OpenTelemetry has expanded on this foundation and introduced more improvements. While OpenTracing was focused primarily on distributed tracing, OpenTelemetry goes beyond tracing to include metrics and logging, providing a more comprehensive observability framework.

OpenTelemetry is also more extensible, providing a broader range of APIs and SDKs that cover more languages and platforms. It also supports more integrations and exporters, making plugging into different backends and analysis tools easier.

However, the most significant difference is the vendor neutrality of OpenTelemetry. While OpenTracing did provide a vendor-neutral API, OpenTelemetry takes this a step further by providing a complete, vendor-neutral observability stack, including APIs, SDKs, and collector services. This means developers can instrument their applications once and choose the backend that best suits their needs without worrying about vendor lock-in.

Learn more in our detailed guide to OpenTelemetry vs OpenTracing 

Migrating from OpenTracing to OpenTelemetry 

Below, we provide a high-level overview of the migration process. For more details, see the official migration guide.

Step 1: Install OpenTelemetry SDK and Remove the Current OpenTracing Implementation

The OpenTelemetry SDK is a set of libraries that implements the OpenTelemetry API and includes additional features for control and configuration. You can find SDKs for different languages, including Java, Python, Go, and more.

Installing the OpenTelemetry SDK is typically straightforward. Once the SDK is installed, you can remove the current OpenTracing implementation in your application.

Removing the current OpenTracing implementation must be done carefully, ensuring no critical tracing functionality is lost during the transition. The OpenTelemetry SDK is designed to provide equivalent or superior functionality to OpenTracing, so you should be able to replace all existing OpenTracing capabilities.

Step 2: Install the OpenTelemetry Instrumentation Libraries and Remove the OpenTracing Equivalents

The next step in the migration process is to install the OpenTelemetry instrumentation libraries. These libraries provide automatic instrumentation for various frameworks and libraries, significantly reducing the amount of manual work required to instrument your application.

Installing these libraries usually involves adding a dependency to your project. Once installed, they automatically generate telemetry data from your application, which can then be collected and analyzed.

After installing the OpenTelemetry instrumentation libraries, you can proceed to remove the OpenTracing equivalents. Like removing the OpenTracing SDK, this process must be done carefully to ensure no important functionality is lost.

Step 3: Update Your Dashboards and Alerts to Consume OpenTelemetry Data

After installing the OpenTelemetry SDK and instrumentation libraries, you need to update your observability dashboards, alerts, and other tools to consume the new OpenTelemetry data.

Because OpenTelemetry data is structured differently from OpenTracing data, this step might require modifications to your existing dashboards and alerts. However, the benefits of using OpenTelemetry—such as improved consistency and the ability to collect a wider range of data—make this effort worthwhile.

Step 4: Write All New Instrumentation Using the OpenTelemetry API

When you start writing new application code after migrating to OpenTelemetry, it’s important to write all new instrumentation using the OpenTelemetry API. This approach helps you take full advantage of the features provided by OpenTelemetry and ensures consistency throughout your application.

Step 5: Progressively Re-Instrument Your Application Using the OpenTelemetry API

It’s important to realize that OpenTelemetry is backward compatible with OpenTracing. So you do not need to go back and change instrumentation previously done for OpenTracing. However, over time, it is recommended that the instrumentation be updated to take advantage of new features available in OpenTelemetry.

This process involves going through your application and replacing the old OpenTracing instrumentation with new OpenTelemetry instrumentation.

Re-instrumenting your application is a significant task, especially for large and complex applications. By implementing this step progressively, you can spread the work over time and minimize disruption to your development process.

Microservices Monitoring with Lumigo

OpenTelemetry offers a pluggable architecture that enables you to add technology protocols and formats easily. Using OpenTelemtry, Lumigo provides containerized applications with end-to-end observability through automated distributed tracing.

Debug fast and move on.

  • Resolve issues 3x faster
  • Reduce error rate
  • Speed up development
No code, 5-minute set up
Start debugging free