Repository navigation
Enforce module identity across metric alerts - #79
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ba39231d0d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @@ -1,2 +1,3 @@ | |||
| robotframework | |||
| robotframework-sshlibrary | |||
| PyYAML | |||
There was a problem hiding this comment.
Refresh cached test environments for the new dependency
On any machine that has already run test-module.sh, the persistent rftest-cache volume contains an executable Robot installation, so lines 31-34 of that script skip pip install entirely. Adding PyYAML here therefore does not install it in those cached environments, and the new test_provision_prometheus.py fails during collection with ModuleNotFoundError: yaml; the dependency installation needs to run when the requirements change rather than only when Robot is absent.
AGENTS.md reference: AGENTS.md:L6-L6
Useful? React with 👍 / 👎.
DavidePrincipi
left a comment
There was a problem hiding this comment.
LGTM. Looking forward to phase 2.
Limit module scoping to generic alert identifiers so existing mapped portal IDs remain stable. #79 (comment) Assisted-by: Codex:GPT-5
Cover generic per-module identifiers and verify every known mapping retains its legacy portal ID when module_id is present. #79 (comment) Assisted-by: Codex:GPT-5
Synchronize cached Robot environments with the current requirements on every run so newly added dependencies are installed. #79 (comment) Assisted-by: Codex:GPT-5
Document generic module scoping while preserving mapped portal IDs, and remove the inapplicable provider-rule upgrade scenario. #79 (comment) Assisted-by: Codex:GPT-5
5432f3e to
f5aef72
Compare
Derive module ownership from each provider Redis key and apply it to scrape targets so module-scoped alert rules cannot consume another provider series. Keep Alertmanager groups and inhibition rules separated by module identity. Assisted-by: Codex:gpt-5.6-sol
f5aef72 to
d36b639
Compare
Describe authoritative target labels, field-level validation, and generated filenames for provider integrations. Record Alertmanager isolation, downstream ID scoping, and upgrade compatibility for alert-proxy consumers. Assisted-by: Codex:gpt-5.6-sol
d36b639 to
90d31a8
Compare
Summary
This is the first implementation phase for provider-published Prometheus
alert rules.
Derive
module_idandtarget_typefrom each provider's Redis key andfield, preventing provider-supplied labels from overriding authoritative
target identity.
Malformed target fields are isolated so they do not prevent valid sibling
fields from being materialized. Conflicting identity labels are replaced
and reported with their Redis provenance.
Alertmanager grouping and inhibition include
module_id, keepingsame-name alerts from different module instances independent.
Generic downstream alert identifiers include a non-empty
module_id.Explicit legacy alert mappings remain unchanged, even when the alert
contains
module_id.Existing built-in node targets remain unchanged.
The Robot test runner now synchronizes its cached Python environment with
tests/pythonreq.txton every run, ensuring newly added dependencies areinstalled.
Compatibility
Explicitly mapped alerts retain their existing portal identifiers:
Generic alerts with a non-empty
module_idreceive a module-scopedidentifier:
Generic alerts without
module_idretain their previous identifiers:Mimir forwarding is unaffected because the complete original alert payload
continues to be forwarded without modification.
Related issue
NethServer/dev#8100
How to test
env PYTHONDONTWRITEBYTECODE=1 \ python3 -m unittest discover -s tests -p 'test_*.py' -v env venvroot=/usr PYTHONDONTWRITEBYTECODE=1 \ python3 -m robot --console verbose \ --output NONE --report NONE --log NONE \ tests/00__unit_tests.robot bash -n test-module.shAll checks pass: nine Python tests and one Robot test.
The tests cover:
module_idis present;module_id;Dependencies
None.