Skip to content

Commit

Permalink
Documentation update with new metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
janciesla8818 committed Jun 22, 2020
1 parent 50c7683 commit 182f40f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
21 changes: 16 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -519,17 +519,26 @@ Where:
* `REASON` is an arbitrary error reason term (in case of `status="error"`) or an empty string (when `status="success"`)
* `LE` defines the `upper inclusive bound` (`less than or equal`) values for buckets, currently `1000`, `10_000`, `25_000`, `50_000`, `100_000`, `250_000`, `500_000`, `1000_000` or `+Inf`

This histogram metric shows the distribution of times needed to:
1. Select a worker (this may include waiting time when all workers are busy).
2. Send a request.
3. Get a response from push notifications provider.

###### HTTP/2 requests

`sparrow_h_worker_handle_duration_microsecond_bucket{le=${LE}}`
`sparrow_h_worker_handle_duration_microsecond_sum{le=${LE}}`
`sparrow_h_worker_handle_duration_microsecond_count{le=${LE}}`

Where:
* `LE` defines the `upper inclusive bound` (`less than or equal`) values for buckets, currently `1000`, `10_000`, `25_000`, `50_000`, `100_000`, `250_000`, `500_000`, `1000_000` or `+Inf`

> **NOTE**
>
> A bucket of value 250_000 will keep the count of measurements that are less than or equal to 250_000.
> A measurement of value 51_836 will be added to all the buckets where the upper bound is greater than 51_836.
> In this case these are buckets `100_000`, `250_000`, `500_000`, `1000_000` and `+Inf`
This histogram metric shows the distribution of times needed to:
1. Select a worker (this may include waiting time when all workers are busy).
2. Send a request.
3. Get a response from push notifications provider.

##### Counters

* `mongoose_push_supervisor_init_count{service=${SERVICE}}` - Counts the number of push notification service supervisor starts.
Expand All @@ -538,6 +547,8 @@ This histogram metric shows the distribution of times needed to:
* `mongoose_push_apns_state_init_count` - Counts the number of APNS state initialisations.
* `mongoose_push_apns_state_terminate_count` - Counts the number of APNS state terminations.
* `mongoose_push_apns_state_get_default_topic_count` - Counts the number of default topic reads from cache.
* `sparrow_pools_warden_pools_count` - Counts the number of worker pools.
* `sparrow_pools_warden_workers_count{pool=${POOL}}` - Counts the number of workers operated by a given worker `POOL`.

#### How to quickly see all metrics

Expand Down
4 changes: 3 additions & 1 deletion lib/mongoose_push/metrics/telemetry_metrics.ex
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ defmodule MongoosePush.Metrics.TelemetryMetrics do
"sparrow.h2_worker.handle.duration.microsecond",
event_name: [:sparrow, :h2_worker, :handle],
measurement: :time,
buckets: [10_000, 25_000, 50_000, 100_000, 200_000, 500_000, 1000_000],
reporter_options: [
buckets: [10_000, 25_000, 50_000, 100_000, 200_000, 500_000, 1000_000]
],
description: "A histogram showing time it takes for h2_worker to handle request."
),
Telemetry.Metrics.last_value(
Expand Down
2 changes: 1 addition & 1 deletion test/unit/mongoose_push_telemetry_metrics_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ defmodule MongoosePushTelemetryMetricsTest do
~r/mongoose_push_notification_send_time_microsecond_count{error_category=\"\",error_reason=\"\",service=\"fcm\",status=\"success\"} (?<count>[\d]+)/

fcm_match = Regex.named_captures(fcm_regex, metrics.resp_body)
assert 0 != fcm_match
assert nil != fcm_match
end

test "sparrow periodic metrics" do
Expand Down

0 comments on commit 182f40f

Please sign in to comment.