Original: Taste of Little Sister (wechat official ID: XjjDog), welcome to share, please reserve the source.

If you’ve been working with logging and monitoring for a long time, you’ve probably heard of OpenTracing at some point. Zipkin, Jaeger, SkyWalking all have great support for OpenTracing.

Unfortunately, OpenTracing is a thing of the past, and the APM world is now dominated by a specification called OpenTelemetry.

That’s because, as a standard, OpenTracing has met its match.

1. The little history

Many students have already started Shouting. My OpenTracing has not been very hot yet, but now it has been frozen. Blame Google.

OpenTracing was born in November 2016, and CNCF accepted it as the third project of its foundation. But Google didn’t consider this a standard, so they created their own Specification called OpenCensus.

What is CNCF? Cn does not mean China. Its full name is Cloud Native Computing Foundation, a Foundation under the Linux Foundation, which can be understood as a non-profit organization. Google donated its K8s to CNCF that year.

Prometheus, known to be the creator of Google, has become the de facto standard for monitoring. In addition, all APM on the market are from Dapper’s paper, so this standard of Google will naturally attract attention. OpenCensus also adds metrics in addition to chain tracing, so it’s a little more feature-rich.

This is hard for developers. Does a technical scenario need two specifications?

Finally, in 2019, the two reconciled with the launch of OpenTelemetry, which stands for Telemetry, and you can see how ambitious it is.

2. What does OpenTelemetry contain?

In terms of logging, monitoring, and invocation chains, I drew a graph two years ago, but it was ambiguous to see only what components were involved. The whole system is to collect, process and apply these three types of data (logs, metrics, trace).

Today, things have changed a bit. At present, the mainstream programs are Promethus, Grafana, Telegraf (or various export), Loki (ELKB), Skywallking, etc. Users need to understand multiple systems and provide effective integration solutions.

Every structure of data flow and processing is different, which is why I always emphasize divide-and-conquer. But use the way, had better not differ too much. No matter how complex the back-end architecture is, an overall look and feel will make the product clearer. Is that where your current work is focused?

The words above are xjjDog’s own, and represent the myths about these three types of data (metrics, logs, call chains) as a consumer and practitioner of the specification. Now the situation has improved. Because of the OpenTelemetry specification, it wants to include all of these technical metrics. It is a vendor-independent specification and a set of tools that can make developers happier. But the specification wasn’t an easy task until version 1.0 of OpenTelemetry in 2021.02.10.

Take a look at OpenTelemetry, opentElemetyr.io /. And that’s what it’s all about.

  • Traces are a tree of traditional call chains
  • The Metrics runtime captures or calculates statistics that vary over time
  • Logs, such as exception Logs or additional information

Information processing, of course, also inseparable from the collection, processing, display three stages.

As can be seen, compared with OpenTracing, there are more monitoring indicators such as Metrics. With the increasing storage and computing power of distributed systems, it is possible to put all this information together! With dedicated SDKS and unified protocols, cross-platform, which used to be difficult, is no problem now.

3. How to use it?

Before you use it, you need to understand a few terms. For those familiar with OpenTracing, this is not a big deal.

  • Traces call chains. A trrace contains multiple spans. A tree consists of the root span, parent Span, and current span
  • Metrics, including Counter, ValueRecorder, SumObserver, ValueObserver, and other common scenarios
  • Context The Context information contained in each SPAN, which is a globally unique identifier
  • Context propagation propagationPropagation means context transfer between different services.

The OpenTelemetry definition file is described using Protobuf, so it is naturally cross-platform. Collection of information is done by opentElemetry -collector, which is essentially a collection of data, which is similar to Kafka streaming, and similar to logstash and Flume.

Technology goes back and forth, old wine in new bottles.

A typical configuration file might look like this:

service:
  pipelines: # section that can contain multiple subsections, one per pipeline
    traces:  # type of the pipeline
      receivers: [otlp.jaeger.zipkin]
      processors: [memory_limiter.batch]
      exporters: [otlp.jaeger.zipkin]
Copy the code

It includes three parts, Processors, Receivers, and Exporters.

  • Receiver means how to transfer data from other platforms to your own system. Such as receiving specific Prometheus data and converting it into internal loop data
  • The inner loop data can then be processed by the processor, where you can make some changes to the data, but of course configuration is always a hassle
  • What platform would MY friend want to send these messages to? Implement OpenTelemetry specification component, easy to receive these data BA

This is still the traditional three-way idea, but in telegraf, it’s called input, output. But don’t worry, vendors will voluntarily develop receivers and exporters to prove that their systems are compliant.

This is gonna be a lot easier. Each version of SDK, provide a variety of indicators of the API, docking platform is ok.

3. How do you experience it?

There’s an official example, which saves me having to do it.

https://opentelemetry.io/docs/java/instrumentation_examples/
Copy the code

It uses components such as Prometheus, Loki, Tempo, and Grafana, and uses the SpringBoot application as an example. As you can see, there are so many components in it. It takes time, energy and brain to build it by yourself. Docker is the best way.

In fact, it is.

Use the following two steps to complete the deployment.

mvn clean package docker:build
docker-compose up
Copy the code

Well, it looks good and works well. Wish the specification a try soon, because some of the components are still in alpha.

Xjjdog is a public account that doesn’t allow programmers to get sidetracked. Focus on infrastructure and Linux. Ten years architecture, ten billion daily flow, and you discuss the world of high concurrency, give you a different taste. My personal wechat xjjdog0, welcome to add friends, further communication.