secture & code

How OpenTelemetry can save you some headaches

OpenTelemetry offers us an easy and standard way to have a proper traceability in our projects, saving us some headaches.

Hasn't it ever happened to you that you are testing some new feature, but for some reason it doesn't work as it should and you are sure there is no bug? Or how cool it would have been to see which parts of the code were triggered by doing a certain action? OpenTelemetry, OTEL, from now on we will call it OTEL, offers us an easy and standard way to have a proper traceability in our projects.

What is observability?

We can define observability as the ability to know at all times what is going on inside our software by analyzing the outputs it gives us. We can do this by using your telemetry data, which includes traces, metrics and logs.

But before we can see this data, we need to instrument our software. That is, our code must be able to send traces, metrics and logs somewhere. But how do we send that data anywhere, and what if I need to change systems for some reason? For that we have OTEL.

OTEL Observability opentelemetry

What is OTEL or OpenTelemetry?

OTEL is an observability framework that allows us to create and manage our data in the form of traces, metrics and logs. OTEL is agnostic in terms of the systems that can use it, which means that any system that uses OTEL will use it under the same standard. In addition, it gives us a series of APIs and SDKs that will open up a range of languages in which to use it. Of course, we are the owners of the data at all times, no vendor takes ownership of it.

How does OTEL work?

The main components of OTEL can be summarized as follows:

  • APIsAPIs: with APIs we can instrument our code and coordinate data throughout the system. These APIs are language specific so we will have to check how to implement them correctly.
  • SDKsThe SDKs are responsible for supporting the APIs to obtain, process and export our data. Like APIs, they are language-specific.
  • Data specificationsOTLP (OpenTelemetry Procolol) are the specifications that define how the data must be in order to be used in the applications.
  • CollectorOTLP: is the part in charge of receiving the data to be exported, processing them and exporting them in the right way. Use OTLP to know how to do the processing. More information can be found in the official documents.
OTEL Observability opentelemetry

Advantages of using OTEL

One of the main advantages of using OTEL in our projects is that we do not have to reinvent the wheel for data processing, since it is something that the framework itself gives us. We will spend less time developing these mechanisms and if at some point we need to change the observability tool (dashboard), using all the same protocol will not be much of a problem.

Along with that, another advantage is that we own our data and choose what to send and what not to send to our platforms. Because it is so elastic, we can modify our traces at any time to add new data.

In addition, the installation is usually quite fast so we will not lose too much time and the fact that we can use it in many languages allows us to use it in any project we have without having to make large migrations.

By checking our data in some OTEL platform we will be able to consult the trace that our application makes in our use cases, so that any discrepancy with what we expect to obtain will be observable in the dashboard.

You can find more content about development, design and business in more articles from Secture & Code.

Backend

Picture of David Luque Quintana

David Luque Quintana

The best way to learn to program is to program. I currently work with Ruby and React.
Picture of David Luque Quintana

David Luque Quintana

The best way to learn to program is to program. I currently work with Ruby and React.

We are HIRING!

What Can We Do