OpenTracing is a project that offers a vendor-neutral API specification designed to track and monitor application requests. When an application functions, various requests progress through different components of a distributed system, such as microservices. OpenTracing is used to monitor such requests to identify application issues such as performance degrades and other bottlenecks. OpenTracing also reduces the burden on developers by providing a standardized way to collect and report trace data.
Today, however, the OpenTracing project is archived. The official website explains that users are now required to migrate to OpenTelemetry, as the OpenTracing project is no longer supported. OpenTelemetry continues the work started by OpenTracing and has expanded upon it by offering a broader and actively supported observability framework.
Let’s go in depth with how OpenTracing works, what it did for distrusted tracing, and finally look at migrating to OpenTelemetry.
OpenTracing is a project launched in 2016 with contributions from LightStep and Uber. In the same year, the founder of Lightstep wrote a blog post titled "Toward Turnkey Distributed Tracing". This blog post introduced OpenTracing as a common standard for distributed tracing.
After recognizing the importance of standardizing distributed tracing, the Cloud Native Computing Foundation (CNCF) accepted OpenTracing as its own project and released OpenTracing 1.0.
The CNCF continued to research for better solutions for distributed tracing. As a result, CNCF launched OpenTelemetry in 2019 by merging OpenTracing with another competing project called OpenCensus, which was developed by Google. OpenTelemetry combines and expands the features of both projects under one framework.
(Related reading: our complete guide to OpenTelemetry.)
Distributed tracing is the process of tracking requests as they pass through different components in a distributed system, such as applications built with microservices. Tracing requests in distributed systems has always been difficult and challenging. OpenTracing is an important evolutionary milestone in distributed tracing.
OpenTracing is a framework built on distributed tracing fundamentals. Provided in nine different programming languages, it standardizes the implementation of distributed tracing across different systems. By offering a vendor-neutral API, OpenTracing allows developers to:
Before OpenTracing was introduced, distributed tracing was less standardized. Many organizations had to develop their own tracing systems from scratch. These custom solutions were developed to suit only their own architectures. Custom systems lacked interoperability with other systems or tools outside the organization. Indeed, the cloud era really accelerated the challenges of interoperability.
For the organizations that did not build their own tracing solutions, the alternative was often to adopt vendor-specific tracing tools. While these tools could be powerful, they typically require committing to a particular technology stack or vendor. This restricted the flexibility and increased costs, especially when scaling or transitioning to different technologies.
So, there was no standard approach to tracing.
The results? Different teams within a single organization implemented their tracing differently. This inconsistency created:
Also, without having a tracing standard, integrating different tools and making them work well together was often a manual and error-prone process. Each new tool or update required significant updates to make them compatible with existing tracing solutions.
OpenTracing was designed to be useful for complex applications such as those in microservices architectures, distributed systems, and cloud-native environments where tracking requests across multiple components is important.
Also, the OpenTracing framework is essential for asynchronous processing systems, big data applications, and financial platforms that require more insight into data flow and transaction paths.
As OpenTracing is vendor-neutral it does not tie developers to any specific tracing system or technology. This flexibility helps organizations to implement any custom or third-party distributed tracing tools that best fit their needs without being restricted by specific network protocols or data formats.
In a microservices architecture, where numerous applications communicate and interact with each other, understanding the flow of requests and diagnosing issues can be messy. OpenTracing provides a standardized way to collect and report trace data across all these services.
Pros | Cons |
|
|
We can break down the process used in OpenTracing into several steps.
The first step involves adding instrumentation to the codebase. This means integrating OpenTracing libraries into the application to capture information about operations, such as API calls, database queries, or internal processes.
Developers insert spans at strategic points within their code, which represent specific operations within a larger trace.
When a request is made to the application, a trace is initiated, and the first span (often called the root span) is started. As the request moves through various components of the application, additional spans are started and stopped. Each span captures key data such as the start time, end time, and metadata about the operation it represents.
As the request travels across process boundaries such as between microservices the trace context (which includes trace and span identifiers) is propagated along with it. This is typically done through HTTP headers in web applications. This propagation helps all spans across services to be linked together to form a complete trace.
Each span records its data, which includes timing information, any errors encountered, and additional metadata. Once a span is completed, it reports this data back to a central tracking system.
The collected trace data is processed and visualized in a tracing tool, such as Jaeger or Zipkin. These tools provide a visual representation of the trace. They demonstrate the sequence of span operations across services and how much time each operation took.
There are several key components of the openTracing Architecture.
Tracer: This is the main component that creates and manages spans. It understands how to serialize and deserialize span information across system boundaries. Handles the tracing data's lifecycle.
Span: Spans are the basic units of work in OpenTracing. They represent the specific operations within the system. Each span captures information such as:
Spans include tags and logs to enrich the trace data with useful metadata and runtime events.
SpanContext: This carries metadata necessary for span propagation across process boundaries. It includes trace and span IDs that uniquely identify each span. SpanContext also contains baggage items and key-value pairs that pass across different spans in the same trace. They help to preserve the state across asynchronous operations.
References: Spans may reference other spans, typically using two types: "ChildOf", indicating direct dependency, and "FollowsFrom", indicating indirect or asynchronous relationships. These references help define the structure of a trace.
Tags and Logs: Tags are key-value pairs attached to spans that label attributes relevant to trace analysis, like HTTP status codes or user IDs. Logs record timestamped events within a span’s life. They provide granular insights into the application’s behavior at specific moments.
Baggage Items: These are key-value pairs included in the SpanContext that can be accessed across the entire trace and are useful for maintaining state across the system.
(Related reading: What is MELT? Metrics, events, logs & traces.)
Implementing OpenTracing in your application involves several key steps.
1. Choose a tracing backend. Decide on a tracing backend that will collect, store, and visualize the traces. Common options include Jaeger, Zipkin, and LightStep.
2. Add OpenTracing libraries. Considering the programming language you are using. Then, add the appropriate OpenTracing libraries to your project. OpenTracing supports multiple programming languages such as Java, Python, JavaScript, Go, etc.
3. Initialize the tracer. Initialize the tracer object in your application. This object is responsible for starting and managing spans. This involves configuring the tracer to communicate with your chosen backend.
4. Instrument your code. Add spans around operations you want to trace.
5. Propagate the context. After implementing basic tracing, run your application and verify that spans are reported correctly to your tracing backend.
6. Increase the scope. Later, you can add more spans, enrich spans with tags and logs for additional context, and use baggage for cross-processing information.
OpenTracing isn't exactly dead. However, it was merged into a more comprehensive framework called OpenTelemetry with the goal of creating a unified, vendor-neutral standard for observability. It covers not just tracing but also metrics and logs. Organizations are encouraged to migrate to OpenTelemetry to benefit from its broader capabilities.
For users of OpenTracing, migrating to OpenTelemetry is not mandatory, but it's highly recommended — particularly for its active development and broader support.
As you migrate, compare the new traces with those generated by OpenTracing to make sure that you are capturing the required information. Fine-tune your OpenTelemetry implementation to optimize performance.
For those seeking options to implement distributed tracing in a new project, starting with OpenTelemetry is advisable. For individuals already utilizing OpenTracing, migrating to OpenTelemetry comes highly recommended.
However, if you want to learn about distributed tracing, OpenTracing would be a good starting point. It will give you a solid understanding of the fundamentals of a vendor-neutral distributed tracing framework. Once you have a proper grasp of OpenTracing, transitioning to OpenTelemetry will be easier.
See an error or have a suggestion? Please let us know by emailing ssg-blogs@splunk.com.
This posting does not necessarily represent Splunk's position, strategies or opinion.
The Splunk platform removes the barriers between data and action, empowering observability, IT and security teams to ensure their organizations are secure, resilient and innovative.
Founded in 2003, Splunk is a global company — with over 7,500 employees, Splunkers have received over 1,020 patents to date and availability in 21 regions around the world — and offers an open, extensible data platform that supports shared data across any environment so that all teams in an organization can get end-to-end visibility, with context, for every interaction and business process. Build a strong data foundation with Splunk.