Telemetry events for election
Closed this issue · 1 comments
I am using OpenTelemetry to monitor my system and I'm recording spans for all of my ecto queries. In order to see what's triggering these queries, I've also created spans for higher level events oban events like:
[:oban, :job, *]
[:oban, :engine, :refresh, *]
[:oban, :plugin, *]
This gives me the source of most of my oban related ecto spans, but I'm still seeing the following query that's not attached to any span.
INSERT INTO "public"."oban_peers" ("expires_at","name","node","started_at") VALUES ($1,$2,$3,$4) ON CONFLICT DO NOTHING
This seems to be coming from here:
https://github.com/sorentwo/oban/blob/v2.13.5/lib/oban/peers/postgres.ex#L89-L96
Desired solution
It would be awesome if we could have a the following new events that occur during leader election
[:oban, :peers, :election, :start]
[:oban, :peers, :election, :stop]
[:oban, :peers, :election, :exception]
It appears that there's both Postgres and Global Peers modules so both would need to be instrumented.
Alternatives Considered
I also looked at the [:oban, :notifier, :notify, *]
events, but it seems like the Notifier is called by the election process and wouldn't allow me to create the top level spans I need.
@aaronrenner Great suggestion. A PR to add that span is welcome; otherwise, I'll get to this before the 2.14 release.