alertmanager icon indicating copy to clipboard operation
alertmanager copied to clipboard

feat(3920): add msteamsv2 receiver

Open sschne opened this issue 1 year ago • 2 comments

fixes #3920

This is based on the work done in https://github.com/prometheus/alertmanager/pull/3921 from @zhan9san. It creates a new receiver as requested in the Review.

If you can come up with a better name than msteamsv2, please let me know :)

sschne avatar Sep 06 '24 13:09 sschne

@simonpasquier @w0rm @gotjosh could you please help here ? msteams webhook deprecation date is near and we need some working solution with msteams workflows to migrate our workloads to.

praveenjindal62 avatar Sep 17 '24 09:09 praveenjindal62

Thanks so much for the implementation @sschne. I just have one comment. I don't fully understand the code as I'm not a Go dev, but I was just wondering if you considered the following point. Does it really make sense to create a v2 receiver to be used by Alertmanager consumers?

As I understand, the receiver can be migrated in place to the new AdaptiveCard format, as the old Teams webhook accepts this input. This would also give Alertmanager some time to iron out any issues in the payload sent to Teams. Then, as people get time to switch to PowerAutomate, they just need to change the URL and it should work out of the box.

This approach was taken by the Flux Notification Controller team in https://github.com/fluxcd/notification-controller/pull/920 and for me the migration went smoothly. I updated to the latest Notification Controller and confirmed the AdaptiveCard was working in the webhook. Then I created the PowerAutomate workflow and simply switched the URL from the old webhook connector to the new workflow and the migration went through without any downtime.

The guys who worked on the Notification Controller added logic that would send a certain payload based on the webhook URL, just like what was proposed in #3921, which may add an extra layer of safety if users have highly customized their Teams payloads on the Alertmanager config side.

I guess internally, it makes sense to create a concept of an msteams v2 receiver, but from the consumer perspective, it might slow down adoption and increase time of maintenance.

trenslow avatar Oct 14 '24 13:10 trenslow

As I understand, the receiver can be migrated in place to the new AdaptiveCard format, as the old Teams webhook accepts this input.

The main issue we have in Alertmanager is the Summary field. It no longer seems to work with Adaptive Cards or Automate Workflows. Adding a v2 receiver will allow it be to be removed without causing breaking changes for existing users (need to consider that other software like Cortex and Mimir is built on top of Alertmanager too).

grobinson-grafana avatar Oct 22 '24 20:10 grobinson-grafana

Thank you very much all of you for your contributions!

gotjosh avatar Oct 23 '24 10:10 gotjosh

Also looking for help how is this meant to be setup. Do we use the webhook url from connectors or the workflow url? also how to fix the width problem and what should the workflow look like ?

EmKaaaM avatar Nov 27 '24 12:11 EmKaaaM

@EmKaaaM Have you tried the migration plan in https://github.com/prometheus/alertmanager/pull/3921

zhan9san avatar Nov 27 '24 14:11 zhan9san

@EmKaaaM Have you tried the migration plan in #3921

I have tried looking at that, but it didn't seem to work with my Prometheus and Alertmanager setup. Perhaps my workflow is incorrect. Could you perhaps upload the template that you have used ? Or some further instructions! I think it would help out a lot of people that are dealing with this / will be dealing with it in the near future.

EmKaaaM avatar Dec 03 '24 08:12 EmKaaaM