Skip to content

Commit

Permalink
Bump minimal required version of metrics rock
Browse files Browse the repository at this point in the history
`metrics >= 0.9.0` is required to use summary quantiles with
age buckets. `metrics >= 0.5.0, < 0.9.0` is unsupported
due to quantile overflow bug [1]. `metrics == 0.9.0` has bug that do
not permits to create summary collector without quantiles [2].
In fact, user may use `metrics >= 0.5.0`, `metrics != 0.9.0`
if he wants to use metrics without quantiles, and `metrics >= 0.9.0`
if he wants to use metrics with quantiles. But this is confusing,
so let's use a single restriction for both cases.

1. tarantool/metrics#235
2. tarantool/metrics#262

Follows up #224
  • Loading branch information
DifferentialOrange committed Dec 24, 2021
1 parent c18f70d commit 622f724
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test_on_push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- tarantool-version: "2.8"
metrics-version: "0.1.8"
- tarantool-version: "2.8"
metrics-version: "0.9.0"
metrics-version: "0.10.0"
- tarantool-version: "2.8"
coveralls: true
metrics-version: "0.12.0"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ crud.disable_stats()
crud.reset_stats()
```

If [`metrics`](https://github.com/tarantool/metrics) `0.9.0` or greater
If [`metrics`](https://github.com/tarantool/metrics) `0.10.0` or greater
found, metrics collectors will be used by default to store statistics
instead of local collectors. You can manually choose driver if needed.
```lua
Expand Down
17 changes: 12 additions & 5 deletions crud/stats/metrics_registry.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,30 @@ local DEFAULT_AGE_PARAMS = {

--- Check if application supports metrics rock for registry
--
-- `metrics >= 0.9.0` is required to use summary with
-- `metrics >= 0.10.0` is required.
-- `metrics >= 0.9.0` is required to use summary quantiles with
-- age buckets. `metrics >= 0.5.0, < 0.9.0` is unsupported
-- due to quantile overflow bug
-- (https://github.com/tarantool/metrics/issues/235).
-- `metrics == 0.9.0` has bug that do not permits
-- to create summary collector without quantiles
-- (https://github.com/tarantool/metrics/issues/262).
-- In fact, user may use `metrics >= 0.5.0`, `metrics != 0.9.0`
-- if he wants to use metrics without quantiles, and `metrics >= 0.9.0`
-- if he wants to use metrics with quantiles. But this is confusing,
-- so let's use a single restriction for both cases.
--
-- @function is_supported
--
-- @treturn boolean Returns true if `metrics >= 0.9.0` found, false otherwise.
-- @treturn boolean Returns true if `metrics >= 0.10.0` found, false otherwise.
--
function registry.is_supported()
if is_package == false then
return false
end

-- Only metrics >= 0.9.0 supported.
local is_summary, summary = pcall(require, 'metrics.collectors.summary')
if is_summary == false or summary.rotate_age_buckets == nil then
-- Only metrics >= 0.10.0 supported.
if metrics.unregister_callback == nil then
return false
end

Expand Down

0 comments on commit 622f724

Please sign in to comment.