8000 Add tnt_cartridge_config_applied metric by p0rtale · Pull Request #511 · tarantool/metrics · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add tnt_cartridge_config_applied metric #511

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 4, 2025

Conversation

p0rtale
Copy link
@p0rtale p0rtale commented Jul 3, 2025

Added a new metric tnt_cartridge_config_applied to track whether the clusterwide config was successfully applied. It reports 1 if the config was successfully applied and 0 otherwise.

Depends on the cartridge's config_applied var.

Closes TNTP-3354

@p0rtale p0rtale requested a review from Satbek July 3, 2025 11:49
@p0rtale p0rtale self-assigned this Jul 3, 2025
@p0rtale p0rtale force-pushed the cartridge-config-applied branch 2 times, most recently from 0b22c3e to 1d85558 Compare July 4, 2025 07:00
@a1div0 a1div0 requested a review from DifferentialOrange July 4, 2025 09:44
@p0rtale p0rtale force-pushed the cartridge-config-applied branch from 1d85558 to 317059b Compare July 4, 2025 10:03
@Satbek Satbek requested a review from oleg-jukovec July 4, 2025 10:39
CHANGELOG.md Outdated
@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Added
- `tnt_cartridge_config_applied` metric
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- `tnt_cartridge_config_applied` metric
- `tnt_cartridge_config_applied` metric.

Comment on lines 148 to 180
g.test_config_applied_metric = function()
helpers.skip_cartridge_version_less('2.16.1')
local main_server = g.cluster:server('main')

t.helpers.retrying({}, function()
local resp = main_server:http_request('get', '/metrics')
local config_metric = utils.find_metric('tnt_cartridge_config_applied', resp.json)

t.assert_is_not(config_metric, nil, 'Cartridge config applied metric presents in /metrics response')
t.assert_equals(config_metric[1].value, 1, 'Config should be applied')
end)

main_server.net_box:eval([[
local patch = require('cartridge').config_patch_clusterwide
local ok, err = patch({
['conflict'] = {},
['conflict.yml'] = "text",
})
]])

t.helpers.retrying({}, function()
local resp = main_server:http_request('get', '/metrics')
local config_metric = utils.find_metric('tnt_cartridge_config_applied', resp.json)

t.assert_is_not(config_metric, nil, 'Cartridge config applied metric presents in /metrics response')
t.assert_equals(config_metric[1].value, 0, 'Config should not be applied')
end)
end
Copy link
Contributor
@oleg-jukovec oleg-jukovec Jul 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, split the test into two separate tests: config applied and not applied.

@p0rtale p0rtale force-pushed the cartridge-config-applied branch from 317059b to 2dfcea0 Compare July 4, 2025 12:06
@p0rtale p0rtale requested a review from oleg-jukovec July 4, 2025 12:20
@oleg-jukovec oleg-jukovec merged commit f68f0db into master Jul 4, 2025
16 checks passed
@oleg-jukovec oleg-jukovec deleted the cartridge-config-applied branch July 4, 2025 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0