Skip to content

Commit

Permalink
api: rename *_api_* metrics to *_router_*
Browse files Browse the repository at this point in the history
This will help us move to use less confusing naming, especially after
the Tarantool Cartridge support removing.
  • Loading branch information
oleg-jukovec committed Apr 9, 2024
1 parent 57ce240 commit 46cc8c7
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 23 deletions.
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion sharded_queue/router/metrics.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
32 changes: 16 additions & 16 deletions test/metrics_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand All @@ -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,
Expand All @@ -151,16 +151,16 @@ 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,
buried = 0,
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)
Expand Down Expand Up @@ -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)

Expand All @@ -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", {
Expand Down

0 comments on commit 46cc8c7

Please sign in to comment.