From 182f40f03f15f3ebd5e9e1990576b870d9a9f8db Mon Sep 17 00:00:00 2001 From: Jan Ciesla Date: Wed, 17 Jun 2020 16:07:29 +0200 Subject: [PATCH] Documentation update with new metrics --- README.md | 21 ++++++++++++++----- .../metrics/telemetry_metrics.ex | 4 +++- .../mongoose_push_telemetry_metrics_test.exs | 2 +- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index e44952ad..89fa091a 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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 diff --git a/lib/mongoose_push/metrics/telemetry_metrics.ex b/lib/mongoose_push/metrics/telemetry_metrics.ex index f25a7a57..91f0f757 100644 --- a/lib/mongoose_push/metrics/telemetry_metrics.ex +++ b/lib/mongoose_push/metrics/telemetry_metrics.ex @@ -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( diff --git a/test/unit/mongoose_push_telemetry_metrics_test.exs b/test/unit/mongoose_push_telemetry_metrics_test.exs index 21cb91af..4eb6517f 100644 --- a/test/unit/mongoose_push_telemetry_metrics_test.exs +++ b/test/unit/mongoose_push_telemetry_metrics_test.exs @@ -130,7 +130,7 @@ defmodule MongoosePushTelemetryMetricsTest do ~r/mongoose_push_notification_send_time_microsecond_count{error_category=\"\",error_reason=\"\",service=\"fcm\",status=\"success\"} (?[\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