-
Notifications
You must be signed in to change notification settings - Fork 23
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/timestamps and spans #162
Merged
Merged
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
f452747
Add event metadata to telemetry new user event
NelsonVides a9a30fa
Add telemetry span-like event for scenario start and stop
NelsonVides 63739e1
Add timestamps to telemetry controller manual actions
NelsonVides fe9392e
Add timestamps to telemetry throttle events
NelsonVides 4003638
Add timestamps to telemetry coordinator events
NelsonVides eb8e44e
Use map mandatory key notation in the telemetry docs
NelsonVides 4525d18
Extract timestamped telemetry events to a helper module
NelsonVides 38d1512
Avoid emulating spans and simply trigger two executes
NelsonVides c494c65
Make all scenario callbacks telemetry spans
NelsonVides File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
%% @private | ||
%% @copyright 2023 Erlang Solutions Ltd. | ||
-module(amoc_telemetry). | ||
|
||
-export([execute/3]). | ||
|
||
-spec execute(EventName, Measurements, Metadata) -> ok when | ||
EventName :: telemetry:event_name(), | ||
Measurements :: telemetry:event_measurements(), | ||
Metadata :: telemetry:event_metadata(). | ||
execute(Name, Measurements, Metadata) -> | ||
TimeStamp = erlang:monotonic_time(), | ||
NameWithAmocPrefix = [amoc | Name], | ||
MetadataWithTS = Metadata#{monotonic_time => TimeStamp}, | ||
telemetry:execute(NameWithAmocPrefix, Measurements, MetadataWithTS). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.e. the exported init/0 function
- this is incorrect, it's rather a span between init/1 and terminate/1 callalso I don't think it's a good idea to manually emulate a span here. because scenario doesn't end itself, it finishes per user request. so duration doesn't indicate real scenario execution here. I would rather rework it into 2 events [amoc, scenario, start|stop] with duration reported for stop event. also reporting error during Scenario:termination/1 call as scenario exeption is incorrect. I think it makes sense to report every scenario callback as telemetry span (and we should do it from amoc_scenario module), and amoc_contorller should only issue telemetry events.
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.
Agree to everything except the idea of running
Scenario:start/
as a telemetry span in theamoc_scenario
module, as this will run in the controller process and measure the time it takes to spawn an erlang process only, instead of measuring the lifespan of the entire amoc user. The current span must stay where it is already and it is the most useful one.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 what you mean here, I propose to measure exactly scenario callback time:
https://github.com/esl/amoc/blob/master/src/amoc_scenario.erl#L64
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.
well, all of the callbacks.
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.
Oooooh, I see, my bad! Ok, one moment.
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.
and amoc_scenario module works as a synchronous wrapper for the callbacks. it doesn't spawn anything.