apache / incubator-devlake

Apache DevLake is an open-source dev data platform to ingest, analyze, and visualize the fragmented data from DevOps tools, extracting insights for engineering excellence, developer experience, and community growth.
https://devlake.apache.org/
Apache License 2.0
2.56k stars 514 forks source link

[Feature] Slack Notifications on Metrics Thresholds #8029

Open SiliconSatchel opened 2 weeks ago

SiliconSatchel commented 2 weeks ago

Search before asking

Use case

As a developer, I want to receive notifications in Slack when certain metrics cross configurable thresholds.

Description

DevLake provides a configuration option that lets the user specify a list of metrics, with a threshold value and a direction. When a metric crosses its threshold in the configured direction, e.g. the pipeline failure rate goes above 20%, a notification is sent to slack. When the metric crosses back to the desired side of the threshold, another notification is sent.

Related issues

This closed feature request mentions Slack notifications: https://github.com/apache/incubator-devlake/issues/5636

Are you willing to submit a PR?

Code of Conduct

dosubot[bot] commented 2 weeks ago

DevLake currently supports sending notifications via HTTP POST requests to a specified endpoint, which can be configured in the .env file using NOTIFICATION_ENDPOINT and NOTIFICATION_SECRET [1]. However, there is no built-in feature specifically for sending notifications to Slack when metrics cross configurable thresholds.

To implement this feature, you can leverage the existing Slack integration located in the backend/plugins/slack/ directory [2]. You would need to extend the notification system to support Slack notifications by:

  1. Configuring Metrics and Thresholds: Define the metrics and their thresholds in the Grafana dashboard JSON files, such as EngineeringOverview.json and AzureDevOps.json [3][4].

  2. Triggering Notifications: Implement logic to monitor these thresholds in real-time and trigger notifications when thresholds are crossed. This logic is not explicitly detailed in the current codebase, so you may need to add this functionality.

  3. Sending Slack Notifications: Use the existing Slack plugin to format and send messages. The implementation details for sending messages can be found in impl/impl.go and tasks/task_data.go [2][5].

By following these steps, you can extend DevLake to send Slack notifications when metrics cross specified thresholds.

To continue talking to Dosu, mention @dosu.