Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Registers telemetry events #493

Merged

Conversation

isaacsanders
Copy link
Contributor

@isaacsanders isaacsanders commented Nov 12, 2021

Fixes #492

iex(1)> :telemetry_registry.discover_all(:quantum)
:ok
iex(2)> :telemetry_registry.spannable_events()
[{[:quantum, :job], [:start, :stop, :exception]}]
iex(3)> :telemetry_registry.list_events
[
  {[:quantum, :job, :add], Quantum.JobBroadcaster,
   %{
     description: "dispatched when a job is added",
     measurements: "%{}",
     metadata: "%{job: Quantum.Job.t(), scheduler: atom()}"
   }},
  {[:quantum, :job, :delete], Quantum.JobBroadcaster,
   %{
     description: "dispatched when a job is deleted",
     measurements: "%{}",
     metadata: "%{job: Quantum.Job.t(), scheduler: atom()}"
   }},
  {[:quantum, :job, :exception], Quantum.Executor,
   %{
     description: "dispatched on job execution fail",
     measurements: "%{duration: integer()}",
     metadata: "%{telemetry_span_context: term(), job: Quantum.Job.t(), node: Node.t(), scheduler: atom(), kind: :throw | :error | :exit, reason: term(), stacktrace: list()}"
   }},
  {[:quantum, :job, :start], Quantum.Executor,
   %{
     description: "dispatched on job execution start",
     measurements: "%{system_time: integer()}",
     metadata: "%{telemetry_span_context: term(), job: Quantum.Job.t(), node: Node.t(), scheduler: atom()}"
   }},
  {[:quantum, :job, :stop], Quantum.Executor,
   %{
     description: "dispatched on job execution end",
     measurements: "%{duration: integer()}",
     metadata: "%{telemetry_span_context: term(), job: Quantum.Job.t(), node: Node.t(), scheduler: atom(), result: term()}"
   }},
  {[:quantum, :job, :update], Quantum.JobBroadcaster,
   %{
     description: "dispatched when a job is updated",
     measurements: "%{}",
     metadata: "%{job: Quantum.Job.t(), scheduler: atom()}"
   }}
]

@coveralls
Copy link

coveralls commented Nov 12, 2021

Pull Request Test Coverage Report for Build 9215c94f941991cc7dec5bc56142d8693a46635b-PR-493

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 86.19%

Totals Coverage Status
Change from base Build 1387b539ca66ec1b4fd2da6f3bb22554e88b590f: 0.0%
Covered Lines: 362
Relevant Lines: 420

💛 - Coveralls

@maennchen
Copy link
Member

@isaacsanders Thanks!

I was wondering, if it would be better to move the events into a module that has a @moduledoc and include telemetry_docs() in there. What do you think?

Should we add something similar to your example above to the tests?

@isaacsanders
Copy link
Contributor Author

how do you like this newest set of changes?

@maennchen
Copy link
Member

@isaacsanders Do you think that we should have a separate module for the Telemetry Docs? I think it would also be fine to add it directly to the Quantum module itself. What do you think?

@maennchen
Copy link
Member

@isaacsanders Awesome, thank you 🙂

@maennchen maennchen merged commit 088fb23 into quantum-elixir:master Nov 15, 2021
@isaacsanders isaacsanders deleted the feat/register-telemetry-events branch November 16, 2021 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Documenting telemetry events with telemetry_registry
3 participants