monitoring(testing): retain scalar branch labels
This commit is contained in:
parent
89802bcb11
commit
fc0dde6e88
@ -164,6 +164,26 @@ def test_quality_rollups_do_not_run_every_minute() -> None:
|
|||||||
assert quality["eval_offset"] == "1m"
|
assert quality["eval_offset"] == "1m"
|
||||||
|
|
||||||
|
|
||||||
|
def test_quality_scalar_rollups_infer_legacy_branch_labels() -> None:
|
||||||
|
"""Attach build branches to publishers that still omit the label."""
|
||||||
|
manifest = _documents(
|
||||||
|
REPO_ROOT / "services/monitoring/vmalert-atlas-availability.yaml"
|
||||||
|
)[0]
|
||||||
|
quality = yaml.safe_load(manifest["data"]["platform-quality.yaml"])["groups"][0]
|
||||||
|
rules = {rule["record"]: rule["expr"] for rule in quality["rules"]}
|
||||||
|
|
||||||
|
for record in (
|
||||||
|
"platform_quality:suite_coverage_percent:latest_1h",
|
||||||
|
"platform_quality:suite_source_files_total:latest_1h",
|
||||||
|
"platform_quality:suite_source_lines_over_500_total:latest_1h",
|
||||||
|
):
|
||||||
|
expression = rules[record]
|
||||||
|
assert 'branch=""' in expression
|
||||||
|
assert "group_left(branch)" in expression
|
||||||
|
assert "platform_quality_gate_build_info" in expression
|
||||||
|
assert '"branch", "unknown"' in expression
|
||||||
|
|
||||||
|
|
||||||
def test_vmalert_reloads_updated_rule_files() -> None:
|
def test_vmalert_reloads_updated_rule_files() -> None:
|
||||||
"""Make Flux ConfigMap updates take effect without manual pod revision bumps."""
|
"""Make Flux ConfigMap updates take effect without manual pod revision bumps."""
|
||||||
manifests = _documents(
|
manifests = _documents(
|
||||||
|
|||||||
@ -219,25 +219,78 @@ data:
|
|||||||
- record: platform_quality:suite_coverage_percent:latest_1h
|
- record: platform_quality:suite_coverage_percent:latest_1h
|
||||||
expr: |
|
expr: |
|
||||||
max by (suite, branch) (
|
max by (suite, branch) (
|
||||||
platform_quality_gate_workspace_line_coverage_percent{exported_job="platform-quality-ci",suite!=""}
|
{__name__=~"platform_quality_gate_workspace_line_coverage_percent|.*_quality_gate_coverage_percent",exported_job="platform-quality-ci",suite!="",branch!=""}
|
||||||
)
|
)
|
||||||
or on (suite, branch)
|
or on (suite, branch)
|
||||||
max by (suite, branch) (
|
(
|
||||||
{__name__=~".*_quality_gate_coverage_percent",exported_job="platform-quality-ci",suite!=""}
|
max by (suite) (
|
||||||
|
{__name__=~"platform_quality_gate_workspace_line_coverage_percent|.*_quality_gate_coverage_percent",exported_job="platform-quality-ci",suite!="",branch=""}
|
||||||
|
)
|
||||||
|
* on (suite) group_left(branch)
|
||||||
|
max by (suite, branch) (platform_quality_gate_build_info{exported_job="platform-quality-ci",suite!="",branch!=""})
|
||||||
|
)
|
||||||
|
or on (suite, branch)
|
||||||
|
(
|
||||||
|
label_replace(
|
||||||
|
max by (suite) (
|
||||||
|
{__name__=~"platform_quality_gate_workspace_line_coverage_percent|.*_quality_gate_coverage_percent",exported_job="platform-quality-ci",suite!="",branch=""}
|
||||||
|
),
|
||||||
|
"branch", "unknown", "__name__", ".*"
|
||||||
|
)
|
||||||
|
unless on (suite)
|
||||||
|
max by (suite) (platform_quality_gate_build_info{exported_job="platform-quality-ci",suite!="",branch!=""})
|
||||||
)
|
)
|
||||||
labels:
|
labels:
|
||||||
rollup: hourly
|
rollup: hourly
|
||||||
- record: platform_quality:suite_source_files_total:latest_1h
|
- record: platform_quality:suite_source_files_total:latest_1h
|
||||||
expr: |
|
expr: |
|
||||||
max by (suite, branch) (
|
max by (suite, branch) (
|
||||||
platform_quality_gate_source_files_total{exported_job="platform-quality-ci",suite!=""}
|
platform_quality_gate_source_files_total{exported_job="platform-quality-ci",suite!="",branch!=""}
|
||||||
|
)
|
||||||
|
or on (suite, branch)
|
||||||
|
(
|
||||||
|
max by (suite) (
|
||||||
|
platform_quality_gate_source_files_total{exported_job="platform-quality-ci",suite!="",branch=""}
|
||||||
|
)
|
||||||
|
* on (suite) group_left(branch)
|
||||||
|
max by (suite, branch) (platform_quality_gate_build_info{exported_job="platform-quality-ci",suite!="",branch!=""})
|
||||||
|
)
|
||||||
|
or on (suite, branch)
|
||||||
|
(
|
||||||
|
label_replace(
|
||||||
|
max by (suite) (
|
||||||
|
platform_quality_gate_source_files_total{exported_job="platform-quality-ci",suite!="",branch=""}
|
||||||
|
),
|
||||||
|
"branch", "unknown", "__name__", ".*"
|
||||||
|
)
|
||||||
|
unless on (suite)
|
||||||
|
max by (suite) (platform_quality_gate_build_info{exported_job="platform-quality-ci",suite!="",branch!=""})
|
||||||
)
|
)
|
||||||
labels:
|
labels:
|
||||||
rollup: hourly
|
rollup: hourly
|
||||||
- record: platform_quality:suite_source_lines_over_500_total:latest_1h
|
- record: platform_quality:suite_source_lines_over_500_total:latest_1h
|
||||||
expr: |
|
expr: |
|
||||||
max by (suite, branch) (
|
max by (suite, branch) (
|
||||||
platform_quality_gate_source_lines_over_500_total{exported_job="platform-quality-ci",suite!=""}
|
platform_quality_gate_source_lines_over_500_total{exported_job="platform-quality-ci",suite!="",branch!=""}
|
||||||
|
)
|
||||||
|
or on (suite, branch)
|
||||||
|
(
|
||||||
|
max by (suite) (
|
||||||
|
platform_quality_gate_source_lines_over_500_total{exported_job="platform-quality-ci",suite!="",branch=""}
|
||||||
|
)
|
||||||
|
* on (suite) group_left(branch)
|
||||||
|
max by (suite, branch) (platform_quality_gate_build_info{exported_job="platform-quality-ci",suite!="",branch!=""})
|
||||||
|
)
|
||||||
|
or on (suite, branch)
|
||||||
|
(
|
||||||
|
label_replace(
|
||||||
|
max by (suite) (
|
||||||
|
platform_quality_gate_source_lines_over_500_total{exported_job="platform-quality-ci",suite!="",branch=""}
|
||||||
|
),
|
||||||
|
"branch", "unknown", "__name__", ".*"
|
||||||
|
)
|
||||||
|
unless on (suite)
|
||||||
|
max by (suite) (platform_quality_gate_build_info{exported_job="platform-quality-ci",suite!="",branch!=""})
|
||||||
)
|
)
|
||||||
labels:
|
labels:
|
||||||
rollup: hourly
|
rollup: hourly
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user