camptocamp / grafana-prometheus-alertmanager-datasource

Grafana Datasource for the Prometheus Alertmanager
Apache License 2.0
287 stars 58 forks source link

[Solution Provided] Summarization by Alert State #103

Open renzsickle opened 3 years ago

renzsickle commented 3 years ago

I've made a few changes for a customer and would like to offer them back to the core project. Could I get some feedback on the below?

In summary:

Added the ability to show an additional column with the state of each alert (active, suppressed or inhibited).
Added a summary display mode, which shows a count of alerts in each state (works better with the multistat panel).
Added the ability to toggle between full (original) and summary display modes.

In detail:

Added the ability to show an additional column with the state of each alert (active, suppressed or inhibited). image image Added a summary display mode, which shows a count of alerts in each state (works better with the multistat panel). Added the ability to toggle between full (original) and summary display modes. image image Column and label filters work in summary display mode. image Summary display mode easily translates into multistat panels. image Sample configuration for multistat panels: image image If these changes are of interest, I have a patchfile ready to go.

hbollon commented 2 years ago

Hi @renzsickle, Your additions seems very interesting ! Can you make a PR for me to have a look please?

renzsickle commented 2 years ago

Sure. It's been some time since I posted this, but I have been able to branch from an older commit and apply the patch file. However, when I try to push my new branch up, I encounter the following error:

$ git push origin feature/alert_summary ERROR: Permission to camptocamp/grafana-prometheus-alertmanager-datasource.git denied to renzsickle. fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

As I haven't contributed to a project on Github before, this may well be an error in my configuration (I just setup a fresh SSH key) - or I might genuinely not have access (my new key was enough to clone the repository). I've also uploaded the patch below for viewing:

summary_view_patch.txt

It seems to apply cleanly to commit a22631ea7801e486bca638d302beaf939b4b252d.

Please let me know how you'd like to proceed.

hbollon commented 2 years ago

Hi @renzsickle It's a normal behavior, you must create a PR from your own fork :wink:

There is the how-to:

  1. Fork the project
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some amazing stuff')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Create a new Pull Request

Don't hesitate to ping me if you need further help :+1: