beam-telemetry/telemetry_poller

Convert to Erlang?

tsloughter opened this issue · 13 comments

Wondering if this library shouldn't also be Erlang since telemetry is and this is something that will definitely be written again if telemetry catches on with Erlang.

I may ask the same regarding metrics but after discussing more today I'm not sure its use is what I was thinking, so need to think about that one some more.

It is fine by me especially because this is transparent to most users!

@josevalim that's a valid point. I wasn't convinced initially, but indeed, most users will probably just configure measurements they're interested in using app.config or config.exs.

@arkgil the only issue is custom measurements. but maybe for this one we do provide an Elixir facade as Telemetry.Poller that only implements child_spec/1 and starts the underlying erlang process.

lpil commented

That would be great, I was planning to implement such a facade for Gleam

I'm nearing completion on this. Should have a PR up within the week.

@josevalim what was the concern you had about needing a facade for Elixir? @arkgil and I were struggling to figure that out.

I am totally fine with the conversion to Erlang for this project. As long as we define a child_spec/1 in telemetry_poller, we are good to go. I wouldn't even define an Elixir module. My other concern is about documentation, but again, the user interface to the telemetry poller is quite limited, so it is fine.

Those concerns are accentuated on Telemetry.Metrics though. It is going to be the main way users interact with Telemetry and it heavily relies on structs, which don't have an equivalent in Erlang. So I wouldn't convert that one to Erlang quite yet, but this one is fine.

For Metrics I'd suggest just using OpenCensus (soon to be OpenTelemetry which will make this nice and confusing -- "In Erlang instead of Telemetry.Metrics you can use OpenTelemetry metrics...") as the suggested tool for the user to use to describe metrics. Assuming there isn't some change that makes it possible to share a Telemetry.Metrics interface.

So really only a matter of if someone is writing docs or a blog post describing how you can instrument your Erlang or Elixir apps with the same libraries they would call out this one case and point to OpenTelemetry.

@tsloughter doesn't OpenCensus bring everything related to a reporting backend though? I am fine with establishing a lower-level API that Telemetry.Metrics can call in to, but whatever that API is, it should be only data structures and no knowledge of any reporter.

@josevalim yes, it does. I'm suggesting it since there isn't an Erlang alternative in the Telemetry ecosystem so might as well call out something that does exist and can integrate with Telemetry. If a lower-level API gets made that is another story.

Will note this on the WG meeting agenda, and finally get out a doodle with some possible times to meet.

Oh, just noticed @bryannaegele says he has done the conversion already, nevermind about me working on it this weekend :)

Oh, I see what you mean. Yes, going directly to the reporter without the Telemetry.Metrics bit is always an option too!

@tsloughter I added discussing the direction of and a status update on the OpenCensus -> OpenTelemetry roadmap to the agenda. Let's join that discussion with this one.

Yeah, I wanted to add that to this thread before anyone got ambitious this weekend lol. Only @arkgil knew I'd started it.