Skip to content

Add alerts.libsonnet for generic alert patching, filtering and rendering - #13

Merged
simu merged 4 commits into
mainfrom
feat/alerts
Jul 30, 2026
Merged

Add alerts.libsonnet for generic alert patching, filtering and rendering#13
simu merged 4 commits into
mainfrom
feat/alerts

Conversation

@simu

@simu simu commented Jul 29, 2026

Copy link
Copy Markdown
Member

The new alerts.libsonnet is a cleaned up copy of component-openshift4-monitoring's openshift4-monitoring-alert-patching.libsonnet + the core rendering logic of openshift4-monitoring-prom.libsonnet's generateRules() as renderRules().

The idea is that monitoring components can re-export this library with their global alert config parameter injected into field global_alert_params as follows:

(import 'syn/alerts.libsonnet') {
  global_alert_params+:: std.get(
    inv.parameters,
    'openshift4_monitoring',
    { alerts: {} }
  ).alerts,
} 

Checklist

  • The PR has a meaningful title. It will be used to auto-generate the
    changelog.
    The PR has a meaningful description that sums up the change. It will be
    linked in the changelog.
  • PR contains a single logical change (to build a better changelog).
  • Update the documentation.
  • Categorize the PR by adding one of the labels:
    bug, enhancement, documentation, change, breaking, dependency
    as they show up in the changelog.
  • Link this PR to related issues or PRs.

@simu simu added the enhancement New feature or request label Jul 29, 2026
@simu
simu marked this pull request as ready for review July 30, 2026 07:41
@simu
simu requested a review from a team July 30, 2026 07:41

@HappyTetrahedron HappyTetrahedron left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM. My brain's a bit too addled to look at the patching logic in detail so I primarily verified that the tests test the right things and the golden file looks as it should. afaiu the logic stayed the same as in component-openshift4-monitoring, right?

Wouldn't want to break the foo generator pipeline 🙃

Base automatically changed from feat/alert-routing-discovery to main July 30, 2026 11:08
@simu

simu commented Jul 30, 2026

Copy link
Copy Markdown
Member Author

LGTM. My brain's a bit too addled to look at the patching logic in detail so I primarily verified that the tests test the right things and the golden file looks as it should. afaiu the logic stayed the same as in component-openshift4-monitoring, right?

Yeah, logic is copied from openshift4-monitoring and almost identical (I've added a call to filterRules() in renderGroups() which isn't there in the current prom.generateRules()).

@simu
simu merged commit 294be01 into main Jul 30, 2026
6 checks passed
@simu
simu deleted the feat/alerts branch July 30, 2026 11:24
simu added a commit to appuio/component-openshift4-monitoring that referenced this pull request Jul 30, 2026
….libsonnet`

We've moved the core logic of
`openshift4-monitoring-alert-patching.libsonnet` and
`prom.generateRules()` to `projectsyn/jsonnet-libs` (cf.
projectsyn/jsonnet-libs#13).

This commit updates the compnent to use that generic library.
simu added a commit to appuio/component-openshift4-monitoring that referenced this pull request Jul 30, 2026
….libsonnet`

We've moved the core logic of
`openshift4-monitoring-alert-patching.libsonnet` and
`prom.generateRules()` to `projectsyn/jsonnet-libs` (cf.
projectsyn/jsonnet-libs#13).

This commit updates the compnent to use that generic library.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants