Skip to content

Commit

Permalink
Update routing-with-scopes.rst
Browse files Browse the repository at this point in the history
  • Loading branch information
aantn committed Jan 4, 2025
1 parent 069f3c1 commit 8542aa3
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions docs/notification-routing/routing-with-scopes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,37 @@ Note that the order of sinks matters! The first sink that matches a notification
Advanced Scope Conditions
--------------------------

Mapping Prometheus Alerts to Kubernetes Resources
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
In Kubernetes environments, Robusta automatically maps Prometheus alerts to Kubernetes resources according to alert labels.
This lets you route alerts not only based on Prometheus metric labels, but also based on Kubernetes metadata.

For example, to route a Prometheus ``KubePodCrashLooping`` alert based on the related pod's ``app.kubernetes.io/name`` label:

.. code-block:: yaml
sinksConfig:
- slack_sink:
name: test_sink
slack_channel: test-notifications
api_key: secret-key
scope:
include:
- identifier: "KubePodCrashLooping"
labels: "app.kubernetes.io/name=my-app"
Note that we routed based on Kubernetes metadata, not present in Prometheus itself!

.. details:: How does Robusta map Prometheus alerts to Kubernetes resources?

Robusta uses alert labels to map Prometheus alerts to Kubernetes resources.

For example, if a Prometheus alert has labels ``pod=my-pod`` and ``namespace=foo``, Robusta will fetch the relevant Kubernetes pod and associate it with the alert.

If an alert has a label ``deployment=my-deployment``, Robusta will do something similar for Deployments. And so on.

This mapping is done automatically, but can be customized if needed. For more details, refer to :ref:`Relabel Prometheus Alerts`.

AND Logic
^^^^^^^^^^^

Expand Down

0 comments on commit 8542aa3

Please sign in to comment.