From 46cc8c773a77f148460f5093a234be049e225252 Mon Sep 17 00:00:00 2001 From: Oleg Jukovec Date: Mon, 8 Apr 2024 16:05:39 +0300 Subject: [PATCH] api: rename *_api_* metrics to *_router_* This will help us move to use less confusing naming, especially after the Tarantool Cartridge support removing. --- CHANGELOG.md | 6 +++--- README.md | 6 +++--- sharded_queue/router/metrics.lua | 2 +- test/metrics_test.lua | 32 ++++++++++++++++---------------- 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 970c29f..52b854f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Added -- Metric `tnt_sharded_queue_api_role_stats` is a [summary][metrics-summary] +- Metric `tnt_sharded_queue_router_role_stats` is a [summary][metrics-summary] with quantiles of `sharded_queue.api` role API calls (#71). The metric includes a counter of API calls and errors. The metric contains labels in the following format: @@ -39,11 +39,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Changed - Metric `sharded_queue_calls` renamed to - `tnt_sharded_queue_api_statistics_calls_total` (#71). The metric now has + `tnt_sharded_queue_router_statistics_calls_total` (#71). The metric now has labels in the format `{name = "tube_name", state = "call_type"}` instead of `{name = "tube_name", status = "call_type"}`. - Metric `sharded_queue_tasks` renamed to - `tnt_sharded_queue_api_statistics_tasks` (#71). The metric now has labels + `tnt_sharded_queue_router_statistics_tasks` (#71). The metric now has labels in the format `{name = "tube_name", state = "task_state"}` instead of `{name = "tube_name", status = "task_state"}`. - The dependency `cartridge` is removed from the `rockspec` since the module diff --git a/README.md b/README.md index f73d998..09da659 100644 --- a/README.md +++ b/README.md @@ -196,7 +196,7 @@ installed and the feature is not disabled by the configuration. ### Router (`roles.sharded-queue-router` or `sharded_queue.api` for the Cartridge) -* Metric `tnt_sharded_queue_api_statistics_calls_total` is a counter with +* Metric `tnt_sharded_queue_router_statistics_calls_total` is a counter with the number of requests broken down by [the type of request][queue-statistics]. The metric has labels in the following format: @@ -206,7 +206,7 @@ installed and the feature is not disabled by the configuration. `delete`, `touch`, `ack`, `release`. The metric on the `sharded_queue.api` role accumulates values from all buckets. -* Metric `tnt_sharded_queue_api_statistics_tasks` is a gauge with +* Metric `tnt_sharded_queue_router_statistics_tasks` is a gauge with the number of tasks in a queue broken down by [a task state][queue-statistics]. The metric has labels in the following format: @@ -216,7 +216,7 @@ installed and the feature is not disabled by the configuration. `delayed`, `total`. The metric on the `sharded_queue.api` role accumulates values from all buckets. -* Metric `tnt_sharded_queue_api_role_stats` is a [summary][metrics-summary] +* Metric `tnt_sharded_queue_router_role_stats` is a [summary][metrics-summary] with quantiles of `sharded_queue.api` role API calls. The metric includes a counter of API calls and errors and has labels in the following format: diff --git a/sharded_queue/router/metrics.lua b/sharded_queue/router/metrics.lua index e11361b..eb6a7cd 100644 --- a/sharded_queue/router/metrics.lua +++ b/sharded_queue/router/metrics.lua @@ -13,7 +13,7 @@ local function enable(queue) local get_statistic = function(tube) return queue.statistics(tube) end - metrics_stats:enable('api', queue.map(), get_statistic) + metrics_stats:enable('router', queue.map(), get_statistic) end local function observe(latency, tube, method, ok) diff --git a/test/metrics_test.lua b/test/metrics_test.lua index 1114c49..183cba7 100644 --- a/test/metrics_test.lua +++ b/test/metrics_test.lua @@ -120,8 +120,8 @@ local function assert_metric(metrics, name, label, values, filters) end end -g.test_metrics_api = function() - local tube_name = 'metrics_api_test' +g.test_metrics_router = function() + local tube_name = 'metrics_router_test' helper.create_tube(tube_name) g.queue_conn = helper.get_evaler('queue-router') @@ -137,10 +137,10 @@ g.test_metrics_api = function() -- Check metrics on the router. local metrics = get_router_metrics(tube_name) - assert_metric(metrics, "tnt_sharded_queue_api_role_stats_count", "method", { + assert_metric(metrics, "tnt_sharded_queue_router_role_stats_count", "method", { put = task_count, }, {status = "ok"}) - assert_metric(metrics, "tnt_sharded_queue_api_statistics_calls_total", "state", { + assert_metric(metrics, "tnt_sharded_queue_router_statistics_calls_total", "state", { done = 0, take = 0, kick = 0, @@ -151,7 +151,7 @@ g.test_metrics_api = function() ack = 0, release = 0, }) - assert_metric(metrics, "tnt_sharded_queue_api_statistics_tasks", "state", { + assert_metric(metrics, "tnt_sharded_queue_router_statistics_tasks", "state", { ready = 0, taken = 0, done = 0, @@ -159,8 +159,8 @@ g.test_metrics_api = function() delayed = task_count, total = task_count, }) - t.assert_not_equals(get_metric(metrics, "tnt_sharded_queue_api_role_stats"), {}) - t.assert_not_equals(get_metric(metrics, "tnt_sharded_queue_api_role_stats_sum"), {}) + t.assert_not_equals(get_metric(metrics, "tnt_sharded_queue_router_role_stats"), {}) + t.assert_not_equals(get_metric(metrics, "tnt_sharded_queue_router_role_stats_sum"), {}) -- Check metrics on storages. metrics = get_storages_metrics(tube_name) @@ -191,8 +191,8 @@ g.test_metrics_api = function() t.assert_not_equals(get_metric(metrics, "tnt_sharded_queue_storage_role_stats_count"), {}) end -g.test_metrics_api_disabled = function() - local tube_name = 'metrics_api_disabled_test' +g.test_metrics_router_disabled = function() + local tube_name = 'metrics_router_disabled_test' helper.set_cfg({metrics = false}) helper.create_tube(tube_name) @@ -210,23 +210,23 @@ g.test_metrics_api_disabled = function() t.assert_equals(get_metric(metrics, "tnt_sharded_queue_storage_role_stats_count"), {}) end -g.test_metrics_api_disable = function() - local tube_name = 'metrics_api_disable_test' +g.test_metrics_router_disable = function() + local tube_name = 'metrics_router_disable_test' helper.create_tube(tube_name) g.queue_conn:call(utils.shape_cmd(tube_name, 'put'), { 1, { delay = 3 , ttl = 3, ttr = 1} }) local metrics = get_router_metrics(tube_name) - assert_metric(metrics, "tnt_sharded_queue_api_statistics_calls_total", "state", { + assert_metric(metrics, "tnt_sharded_queue_router_statistics_calls_total", "state", { put = 1, }) - assert_metric(metrics, "tnt_sharded_queue_api_statistics_tasks", "state", { + assert_metric(metrics, "tnt_sharded_queue_router_statistics_tasks", "state", { delayed = 1, }) - t.assert_not_equals(get_metric(metrics, "tnt_sharded_queue_api_role_stats"), {}) - t.assert_not_equals(get_metric(metrics, "tnt_sharded_queue_api_role_stats_sum"), {}) - t.assert_not_equals(get_metric(metrics, "tnt_sharded_queue_api_role_stats_count"), {}) + t.assert_not_equals(get_metric(metrics, "tnt_sharded_queue_router_role_stats"), {}) + t.assert_not_equals(get_metric(metrics, "tnt_sharded_queue_router_role_stats_sum"), {}) + t.assert_not_equals(get_metric(metrics, "tnt_sharded_queue_router_role_stats_count"), {}) metrics = get_storages_metrics(tube_name) assert_metric(metrics, "tnt_sharded_queue_storage_statistics_calls_total", "state", {