Skip to content

Commit

Permalink
Add previous_status in metadata of telemetry event (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
burmajam authored Jul 21, 2023
1 parent 19df512 commit 46f58d1
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to
-->

## 1.1.3 - 2023-07-21

### Added

- Added `previous_status` to metadata of telemetry event.

## 1.1.2 - 2023-07-14

### Changed
Expand Down
2 changes: 1 addition & 1 deletion lib/beeline/health_checker.ex
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ defmodule Beeline.HealthChecker do
:get_stream_position,
:get_head_position,
:hostname,
:status,
status: :up_to_date,
interval: 0,
drift: 0,
acceptable_behind_by: 5,
Expand Down
3 changes: 2 additions & 1 deletion lib/beeline/health_checker/impl.ex
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ defmodule Beeline.HealthChecker.Impl do
current_position: situation.current_listener_position,
head_position: situation.current_stream_position,
alive?: _alive?(state.producer),
status: situation.status
status: situation.status,
previous_status: state.status
})

state = %HealthChecker{
Expand Down
10 changes: 10 additions & 0 deletions test/beeline/health_checker/impl_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ defmodule Beeline.HealthChecker.ImplTest do
{:telemetry_event,
%{
status: :up_to_date,
previous_status: _,
prior_position: _,
current_position: 2,
head_position: 5
Expand All @@ -81,6 +82,7 @@ defmodule Beeline.HealthChecker.ImplTest do
{:telemetry_event,
%{
status: :stuck,
previous_status: :up_to_date,
prior_position: _,
current_position: 2,
head_position: 5
Expand Down Expand Up @@ -113,6 +115,7 @@ defmodule Beeline.HealthChecker.ImplTest do
{:telemetry_event,
%{
status: :up_to_date,
previous_status: _,
prior_position: _,
current_position: 2,
head_position: 5
Expand All @@ -138,6 +141,7 @@ defmodule Beeline.HealthChecker.ImplTest do
{:telemetry_event,
%{
status: :up_to_date,
previous_status: :up_to_date,
prior_position: 2,
current_position: 3,
head_position: 7
Expand Down Expand Up @@ -170,6 +174,7 @@ defmodule Beeline.HealthChecker.ImplTest do
{:telemetry_event,
%{
status: :caught_up,
previous_status: _,
prior_position: _,
current_position: 2,
head_position: 3
Expand Down Expand Up @@ -203,6 +208,7 @@ defmodule Beeline.HealthChecker.ImplTest do
{:telemetry_event,
%{
status: :stuck,
previous_status: _,
prior_position: 2,
current_position: 2,
head_position: 12
Expand Down Expand Up @@ -236,6 +242,7 @@ defmodule Beeline.HealthChecker.ImplTest do
{:telemetry_event,
%{
status: :stuck,
previous_status: _,
prior_position: 2,
current_position: 2,
head_position: 12
Expand Down Expand Up @@ -269,6 +276,7 @@ defmodule Beeline.HealthChecker.ImplTest do
{:telemetry_event,
%{
status: :falling_behind,
previous_status: _,
prior_position: 2,
current_position: 5,
head_position: 15
Expand Down Expand Up @@ -302,6 +310,7 @@ defmodule Beeline.HealthChecker.ImplTest do
{:telemetry_event,
%{
status: :falling_behind_more,
previous_status: _,
prior_position: 2,
current_position: 3,
head_position: 16
Expand Down Expand Up @@ -335,6 +344,7 @@ defmodule Beeline.HealthChecker.ImplTest do
{:telemetry_event,
%{
status: :catching_up,
previous_status: _,
prior_position: 2,
current_position: 5,
head_position: 12
Expand Down

0 comments on commit 46f58d1

Please sign in to comment.