PryIn v1.5.2 PryIn.CustomTrace View Source
Functions for managing custom traces.
This can be used to trace for example background jobs.
Start a trace with PryIn.CustomTrace.start(group: "workers", key: "daily_email_worker")
and when the worker is done, call the finish function in the same process with PryIn.CustomTrace.finish()
.
group
and key
are values you can choose freely. They will appear in the web interface and allow you to aggregate
and compare traces over time. A group
can be added to the sidebar navigation for easy access.
Good values for group
can be for example "background_jobs"
or absinthe_requests
if you’re using that for GraphQl. Examples for key
could then be "daily_email_job"
or "all_todos_query"
.
Any metric that is associated with the process PryIn.CustomTrace.start
was called in will
be recorded.
You can set a group and key later (before calling finish()
) with PryIn.CustomTrace.set_group("some_group")
and PryIn.CustomTrace.set_key("some_group")
.
IMPORTANT: If group and key are not set, the trace will not be forwarded to PryIn and so won’t appear in the web interface.
You can also provide a sample rate between 0 and 1 in case you do not want to include every trace. This is useful for code that gets called very often, where a smaller sample already provides significant insights.
Link to this section Summary
Functions
Finishes the custom trace started by calling
PryIn.CustomTrace.start()
within the same process
Sets the group for the custom trace started by calling
PryIn.CustomTrace.start()
within the same process
Sets the key for the custom trace started by calling
PryIn.CustomTrace.start()
within the same process
Starts a custom trace. Can alreay set group and key for the trace. You can also provide a sample rate here
Link to this section Functions
Finishes the custom trace started by calling
PryIn.CustomTrace.start()
within the same process.
Important: You need to set :group and :key at some point before
calling finish()
. Otherwise the trace will be ignored.
Sets the group for the custom trace started by calling
PryIn.CustomTrace.start()
within the same process.
Sets the key for the custom trace started by calling
PryIn.CustomTrace.start()
within the same process.
Starts a custom trace. Can alreay set group and key for the trace. You can also provide a sample rate here:
PryIn.CustomTrace.start(group: "some_group", key: "some_key", sample_rate: 0.1)