hst337

hst337

How to convert telemetry to opentelemetry

I have a lot of libraries which emit telemetry events, and I’d like to covert them into OpenTelemetry spans. I’ve found the opentelemetry_telemetry library, but examples there do not work and it looks heavily outdated, without proper documentation, plus :telemetry doesn’t allow attaching to event by prefix, so I have to write some strange and hacky code to translate spans from one library to another.

It would be nice if anyone could share their experience here, thanks!

Most Liked

benwilson512

benwilson512

Author of Craft GraphQL APIs in Elixir with Absinthe

If you look at libraries like OpenTelemetryOban you can see that the common pattern is to create :telemetry hooks that then initiate open telemetry spans. This allows you to stick with the more general purpose telemetry library while also enabling people who use open telemetry to get otel spans out.

hst337

hst337

You got me wrong. I am not suggesting writing telemetry in otel always. I am suggesting to have a relay which automatically converts all telemetry spans to otel spans, and as far as I can see, there are no limitations for this, but still, every opentelemetry_* library writes this boilerplate from scratch

hst337

hst337

I thought so too, but it turns out that telemetry.span generates unique span context in metadata for every span, so it is possible to convert a telemetry span to opentelemetry span.

bside

bside

It is possible but it has additional requirements. There is no way to try to create spans from every possible event in the system without a mechanism to register the events.

Please note, this undocumented experimental functionality is being removed from this library so do not rely on it.

hst337

hst337

I get this, so there is no way to automatically convert telemetry span events (manually specified or with telemetry_registry) to opentelemetry spans.

There is unimplemented suggestion and deprecated undocumented function.

I’d like to help with this issue, but I don’t have any free time to learn opentelemetry and write the code. I am just a user who doesn’t want to attach numerous opentelemetry libraries just to get what is already emitted in telemetry.

Where Next?

Popular in Questions Top

bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
New
logicmason
Hi there, I'm working through my first release with elixir/phoenix. I've built a release with distillery and found that it crashes when I...
New
Jim
As a follow up to my earlier question: I have the code compiling and running but not getting a successful login from the rest server. ...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
johnnyicon
Hi all, I've just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I'm trying to use Postg...
New
lucidguppy
I have a super simple question about elixir - how would I take a file like this foo bar baz and output a new file that enumerates th...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New

Other popular topics Top

Qqwy
Update: How to use the Blogs & Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3268 119930 1237
New
sergio
In Ruby, I can go: User.find_by(email: "foobar@email.com").update(email: "hello@email.com") How can I do something similar in Elixir? ...
New
dotdotdotPaul
Okay, I'm having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I'm sure I'...
New
yawaramin
In the Dialyzer docs ( http://erlang.org/doc/man/dialyzer.html#requesting-or-suppressing-warnings-in-source-files ), there is a way to tu...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 49522 488
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
josevalim
Hi everyone, One of the features added to Elixir early on to help integration with Erlang code was the idea of overridable function defi...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

We're in Beta

About us Mission Statement