Repository navigation
exporter: improve RGW sync metric path parsing for zone names with special chars - #71642
Conversation
2c424c3 to
17c3624
Compare
17c3624 to
b722285
Compare
avanthakkar
left a comment
There was a problem hiding this comment.
Not related to the changes, but AFAIK Prometheus module doesn't scrape perf counters by default (unless you explicitly set exclude_perf_counters to false). It's mostly ceph-exporter job to do so. Please ignore comment if this is intentional
|
Acknowledged. This fix targets users who explicitly set |
afreen23
left a comment
There was a problem hiding this comment.
Your test cases are passing without your changes as well:
platform linux -- Python 3.9.25, pytest-8.4.2, pluggy-1.6.0 -- /ceph/src/pybind/mgr/.tox/py3/bin/python
cachedir: .tox/py3/.pytest_cache
rootdir: /ceph/src/pybind/mgr
configfile: tox.ini
plugins: requests-mock-1.12.1, xdist-3.8.0, cov-7.1.0, pyfakefs-5.10.2
8 workers [7 items]
scheduling tests via LoadScheduling
prometheus/test_module.py::RgwSyncMetricsTest::test_multi_hyphenated_zone_name
prometheus/test_module.py::RgwSyncMetricsTest::test_underscore_zone_name_long
prometheus/test_module.py::RgwSyncMetricsTest::test_longrunavg_counters_get_separate_fixed_paths
prometheus/test_module.py::RgwSyncMetricsTest::test_hyphenated_zone_name
prometheus/test_module.py::RgwSyncMetricsTest::test_non_sync_metric_not_affected
[gw5] [ 14%] PASSED prometheus/test_module.py::RgwSyncMetricsTest::test_non_sync_metric_not_affected
prometheus/test_module.py::RgwSyncMetricsTest::test_multiple_zones_merged_under_fixed_path
prometheus/test_module.py::RgwSyncMetricsTest::test_underscore_zone_name
[gw2] [ 28%] PASSED prometheus/test_module.py::RgwSyncMetricsTest::test_multi_hyphenated_zone_name
[gw0] [ 42%] PASSED prometheus/test_module.py::RgwSyncMetricsTest::test_hyphenated_zone_name
[gw4] [ 57%] PASSED prometheus/test_module.py::RgwSyncMetricsTest::test_underscore_zone_name
[gw7] [ 71%] PASSED prometheus/test_module.py::RgwSyncMetricsTest::test_underscore_zone_name_long
[gw1] [ 85%] PASSED prometheus/test_module.py::RgwSyncMetricsTest::test_longrunavg_counters_get_separate_fixed_paths
[gw3] [100%] PASSED prometheus/test_module.py::RgwSyncMetricsTest::test_multiple_zones_merged_under_fixed_path
=========================================== 7 passed in 2.26s ===========================================
________________________________________________ summary ________________________________________________
py3: commands succeeded
congratulations :)
Example: data-sync-from-my_zone.fetch_bytes
Old code:
re.search -> group(1) = "my_zone"
re.sub -> "data-sync-from-zone.fetch_bytes"
label -> "my_zone"
New code:
re.match -> group(1) = "my_zone", group(2) = "fetch_bytes"
new_path -> "data-sync-from-zone.fetch_bytes"
label -> "my_zone"
We can keep these enhancements, but this is not a bug fix , the code is working fine.
The only real improvement is replacing the fragile re.sub with a clean direct string construction.
Still we can take this PR if you can edit title,commit, description and take it as enhancement
Also we can add test cases more as now it avoid empty zone names, older used to have.
Thanks
Signed-off-by: Anurag Raut <[email protected]>
b722285 to
357b454
Compare
|
Thanks for the detailed analysis! I've added two additional tests covering an underscore-containing zone name with an underscore-containing counter suffix, and empty zone names. The updated test suite passes with 42 tests. I've also updated the commit message and PR description to reflect this as an enhancement. Please take another look. |
Refers-to: https://tracker.ceph.com/issues/80400
Signed-off-by: Anurag Raut [email protected]
PR Description
This PR improves RGW sync metric path handling for zone names containing special characters, such as underscores.
The Prometheus module previously relied on regex-based parsing of the metric path, which could ambiguously separate the zone name from the counter name. The change explicitly separates the zone name and counter suffix when normalizing RGW sync metrics, preserving the complete zone name as the
source_zonelabel.Regression tests cover hyphenated and underscore-containing zone names, multiple zones, counter suffixes, and unrelated metrics.
The implementation was verified with:
python3 -m flake8 module.py test_module.pytox -e py3 -- prometheus/test_module.py -v40 tests passed9 passedContribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins test classic perfJenkins Job | Jenkins Job Definitionjenkins test crimson perfJenkins Job | Jenkins Job Definitionjenkins test signedJenkins Job | Jenkins Job Definitionjenkins test make checkJenkins Job | Jenkins Job Definitionjenkins test make check arm64Jenkins Job | Jenkins Job Definitionjenkins test submodulesJenkins Job | Jenkins Job Definitionjenkins test dashboardJenkins Job | Jenkins Job Definitionjenkins test dashboard cephadmJenkins Job | Jenkins Job Definitionjenkins test apiJenkins Job | Jenkins Job Definitionjenkins test docsReadTheDocs | Github Workflow Definitionjenkins test ceph-volume allJenkins Jobs | Jenkins Jobs Definitionjenkins test windowsJenkins Job | Jenkins Job Definitionjenkins test rook e2eJenkins Job | Jenkins Job DefinitionYou must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.