Skip to content

Commit

Permalink
Add telemetry event for a coordinator trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
NelsonVides committed Dec 29, 2023
1 parent 9459926 commit 57e6d08
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
11 changes: 10 additions & 1 deletion guides/telemetry.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,24 @@ metadata: #{monotonic_time := integer(),

## Coordinator

### Event
Indicates when a coordinating event was raised, like a process being added for coordination or a timeout being triggered

### Event
```erlang
event_name: [amoc, coordinator, start | stop | add | reset | timeout]
measurements: #{count := 1}
metadata: #{monotonic_time := integer(), name := atom()}
```

### Action triggered
Indicates an action is about to be triggered, either by enough users in the group or by timeout

```erlang
event_name: [amoc, coordinator, execute]
measurements: #{count := num_of_users()}
metadata: #{monotonic_time := integer(), event := coordinate | reset | timeout | stop}
```

## Config

### Internal events
Expand Down
4 changes: 3 additions & 1 deletion src/amoc_coordinator/amoc_coordinator_worker.erl
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ maybe_reset_state(State) ->
State.

-spec reset_state(event_type(), state()) -> state().
reset_state(Event, #state{actions = Actions, accumulator = Acc, n = N} = State) ->
reset_state(Event, #state{actions = Actions, accumulator = Acc, n = N, required_n = ReqN} = State) ->
amoc_telemetry:execute([coordinator, execute], #{count => N},
#{event => Event, configured => ReqN}),
[execute_action(Action, {Event, N}, Acc) || Action <- Actions],
State#state{accumulator = [], n = 0}.

Expand Down

0 comments on commit 57e6d08

Please sign in to comment.