-
Notifications
You must be signed in to change notification settings - Fork 243
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
Telemetry [:commanded, :process_manager, :handle] #418
Telemetry [:commanded, :process_manager, :handle] #418
Conversation
Adds telemetry events for Process Managers.
9dfd949
to
c901aec
Compare
process_manager_name: String.t() | Inspect.t(), | ||
process_manager_module: module(), | ||
process_state: term(), | ||
process_uuid: String.t()} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this also passes the commands dispatched
Some feedback from @slashdotdash a few weeks ago
|
|
||
{:stop, _error, _state} = reply -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why this was here previously, it's not part of the handle/2
API
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{:stop, reason :: term()}
is a supported return value for a process manager's error/3
callback function.
It isn't required, so safe to remove.
commands | ||
|> List.wrap() | ||
|> dispatch_commands(opts, state, event) | ||
|> case do | ||
:ok -> | ||
telemetry_stop(start_time, telemetry_metadata, commands) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I edited this slightly as the previous formatting was tripping my brain for some reason. I can change back if you prefer the with
_metadata} | ||
end | ||
|
||
test "events are emitted with discrete start/stop on retries" do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this test doesn't cover all retry cases, covering every one would be a bit of a burden, but i'm happy to do it if we think its worthwhile.
[:commanded, :process_manager, :handle, :exception] | ||
], | ||
fn event_name, measurements, metadata, reply_to -> | ||
num = Agent.get_and_update(agent, fn num -> {num, num + 1} end) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I decorated with an incrementing number here so i could make sure the assert_receive
's were being received in the right order. Without this you don't get that guarantee, so the tests were misleading
Adds telemetry events for Process Managers.
Contributes to #387