census-instrumentation / opencensus-erlang

A stats collection and distributed tracing framework
https://opencensus.io
Apache License 2.0
135 stars 39 forks source link

Use gen_event for metrics and traces sending #133

Open hauleth opened 5 years ago

deadtrickster commented 5 years ago

why?

hauleth commented 5 years ago

@deadtrickster because right now we are writing something similar on our own, and gen_event has some nice features that can help with management of the reporters/exporters, for example it provides support for deregistration or swapping listeners. Also this would provide interface similar to the 3rd pilar of observability - logs, which are using gen_event as logging dispatcher (both Elixir's Logger and Erlang's logger use that).

tsloughter commented 5 years ago

I don't think logger uses gen_event.

hauleth commented 5 years ago

@tsloughter yeah, my bad.

deadtrickster commented 5 years ago

can you throw some code? I still don't quite get the idea

hauleth commented 5 years ago

@deadtrickster what do you mean by the code? You want PR with the migration to the gen_event?

tsloughter commented 5 years ago

I think he just meant some code that'd show how it'd work.

I don't think it helps because as far as I know we'd still need the process for notifying the manager to kick off the events.

hauleth commented 5 years ago

@tsloughter yes, we would need, but it could be shared one, I am in the process of writing something that will show what I have in mind for that.

hauleth commented 5 years ago

Very rough and very WIP migration #136. However it shows the base idea how I would organise the code.