oncall-engine/engine
Innokentii Konstantinov 9628bdc51f
Webhook labels (#3383)
This PR add labels for webhooks. 
1. Make webhook "labelable" with ability to filter by labels.
2. Add labels to the webhook payload. It contain new field webhook with
it's name, id and labels. Field integration and alert_group has a
corresponding label field as well. See example of a new payload below:
```
{
    "event": {
        "type": "escalation"
    },
    "user": null,
    "alert_group": {
        "id": "IRFN6ZD31N31B",
        "integration_id": "CTWM7U4A2QG97",
        "route_id": "RUE7U7Z46SKGY",
        "alerts_count": 1,
        "state": "firing",
        "created_at": "2023-11-22T08:54:55.178243Z",
        "resolved_at": null,
        "acknowledged_at": null,
        "title": "Incident",
        "permalinks": {
            "slack": null,
            "telegram": null,
            "web": "http://grafana:3000/a/grafana-oncall-app/alert-groups/IRFN6ZD31N31B"
        },
        "labels": {
            "severity": "critical"
        }
    },
    "alert_group_id": "IRFN6ZD31N31B",
    "alert_payload": {
        "message": "This alert was sent by user for demonstration purposes"
    },
    "integration": {
        "id": "CTWM7U4A2QG97",
        "type": "webhook",
        "name": "hi - Webhook",
        "team": null,
        "labels": {
            "hello": "world",
            "severity": "critical"
        }
    },
    "notified_users": [],
    "users_to_be_notified": [],
    "webhook": {
        "id": "WHAXK4BTC7TAEQ",
        "name": "test",
        "labels": {
            "hello": "kesha"
        }
    }
}
```

I feel that there is an opportunity to make code cleaner - remove all
label logic from serializers, views and utils to models or dedicated
LabelerService and introduce Labelable interface with something like
label_verbal, update_labels methods. However, I don't want to tie
webhook labels with a refactoring.

---------

Co-authored-by: Dominik <dominik.broj@grafana.com>
2023-11-22 11:17:41 +00:00
..
apps Webhook labels (#3383) 2023-11-22 11:17:41 +00:00
common Revert "Pass all integration labels down to alert groups" (#3301) 2023-11-08 13:32:10 +00:00
config_integrations Improve template to handle empty group labels (#2794) 2023-08-17 07:52:05 +00:00
engine Add command for restarting acknowledge reminder tasks for organization (#3314) 2023-11-10 10:09:20 +00:00
settings Switch to django-redis, update redis deps (#3387) 2023-11-20 20:27:13 +00:00
static/images remove django admin panel (#2731) 2023-08-02 14:26:50 -04:00
type_stubs/icalendar continue addressing mypy violations (#2170) 2023-06-27 10:23:08 +00:00
.dockerignore One startup command to rule them all (#760) 2022-11-07 16:34:43 +01:00
.gitignore modify push notification settings + use fcm-django library (#998) 2022-12-20 12:41:34 +01:00
celery_with_exporter.sh Add flag to debug logs (#912) 2022-11-29 11:16:42 +08:00
conftest.py Webhook labels (#3383) 2023-11-22 11:17:41 +00:00
Dockerfile Fix tilt file cache_from, optimise dockerfile (#3264) 2023-11-06 12:37:07 +08:00
manage.py World, meet OnCall! 2022-06-03 08:09:47 -06:00
pyproject.toml Re-enable a few mypy rules + fix existing errors (#2725) 2023-08-03 09:43:03 +00:00
requirements-dev.txt re-enable mypy GitHub Actions CI job (#2390) 2023-06-29 14:01:52 +00:00
requirements.txt Switch to django-redis, update redis deps (#3387) 2023-11-20 20:27:13 +00:00
tox.ini Minor formatting changes (#2641) 2023-07-26 14:45:44 +01:00
uwsgi.ini Use Tilt for local development (#1396) 2023-09-07 19:38:19 +08:00
wait_for_test_mysql_start.sh Revert "Revert "speed up ci builds from 15 to <7 minutes"" (#1643) 2023-03-28 09:34:03 +02:00