# Service Dependency Based Deduplication

Service Dependency Based Deduplication works on the logic that the incidents coming in for a Service and its dependencies have a related cause.

It is most likely the case where, when one Service has an incident, it's dependent Service(s) may also have incidents and hence, you will be notified of the incident only once. *This helps control unnecessary alert noise and notification fatigue during critical outages*.

Defining dependencies between Services also helps Squadcast understand the relationship between your actual systems.

To understand this better, let us consider 3 Services: *Service A*, *Service B* and *Service C*.

If *Service A* is <mark style="color:red;">`dependent on`</mark> *Service B* and *Service C*, then:

* **Dependent Service**: *Service A*
* **Dependency Service(s)**: *Service B*, *Service C*

Let’s say, *Service B* has an open incident at *time x* and *Service C* has an open incident at *time x+1*. Now, *Service A* receives an incident. This incident for *Service A* gets deduplicated with the **latest** open incident of its dependency Service(s) - i.e., with the open incident for *Service C*, in this case.

## Prerequisites <a href="#prerequisites" id="prerequisites"></a>

The User Role associated with the user in the Team must have required permissions to manage Services (ability to manage Deduplication Rules).

{% hint style="warning" %} <mark style="color:orange;">**Important:**</mark>\
Automation rule CRUD operations have a 5-minute caching delay before changes take effect.
{% endhint %}

## Add a Service Dependency <a href="#adding-a-service-dependency" id="adding-a-service-dependency"></a>

To add service dependencies:

1. Navigate to **Services** -> **Service Overview** -> select or search for your desired service.
2. On the extreme right, expand the accordion -> **View Dependency** -> you are navigated to a list of dependent services.
3. Click **Add Dependency** -> enter the name of the dependent service.
4. Click **Save**

> In this example, we have considered <mark style="color:red;">`Backend Prometheus Service`</mark> and <mark style="color:red;">`Translations`</mark> Services as dependencies of the <mark style="color:red;">`Payment Portal`</mark> Service.
>
> <img src="https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-19da1255f4b038ab8e27d41ee83470da72c97035%2Fservice-dependancy-based-deduplication_2%20(1)%20(1)%20(1).png?alt=media&#x26;token=83ec7e73-9130-41d7-9a5b-52ac5e8d75c1" alt="Service dependencies in Squadcast" data-size="original">
>
> This means that the <mark style="color:red;">`Payment Portal`</mark> Service is dependent on <mark style="color:red;">`Backend Prometheus`</mark> <mark style="color:red;">`Service`</mark> and <mark style="color:red;">`Translations`</mark>.

## **Delete a Service Dependency**

To delete a service dependency:

1. Click the **Cross** next to the service name to delete the service dependency
2. Click **Save**

## Enabling Service Dependency-Based Deduplication <a href="#enabling-service-dependency-based-deduplication" id="enabling-service-dependency-based-deduplication"></a>

Once you have defined the Service Dependencies, you can set a Service Dependency Based Deduplication rule which would deduplicate all incoming alerts for the chosen Service against the latest open incident of its Service Dependencies.

1. Navigate to **Services** -> **Service Overview** -> select or search for your desired service.
2. On the extreme right, expand the accordion -> In the Automation section, **View All.**
3. In the Automation Rules section, **Add Deduplication Rules.**
4. Check **If this service and service depends on both have an incident, alert only once** -> Click **Save.**

{% hint style="info" %}
**Note:** This checkbox for every Deduplication Rule is disabled by default.
{% endhint %}

<figure><img src="https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-5141b751427f3ff438a71ec57dfa819eff145bc1%2Fservice-dependancy-based-deduplication_4.png?alt=media&#x26;token=75e5cf3f-de72-4ea6-a1a6-a0babfe8e80d" alt="Add Service dependency based deduplication rules in Squadcast"><figcaption></figcaption></figure>

{% hint style="info" %}
**Note:**

1. The Service Dependency Based Deduplication will deduplicate any incoming alert against either a <mark style="color:red;">`Triggered`</mark> or <mark style="color:red;">`Acknowledged`</mark> incident only.
2. Service Dependency-based Deduplication is rule-specific and can be enabled for any number of Deduplication Rules that are defined for a Service.
   {% endhint %}

## Enabling Service Dependency-Based Deduplication for a Specific Service Dependency <a href="#enabling-service-dependency-based-deduplication-for-a-specific-service-dependency" id="enabling-service-dependency-based-deduplication-for-a-specific-service-dependency"></a>

In cases where you would like Squadcast to consider just one of the many dependencies for a Service for Service Dependency Based Deduplication, you can follow the method below.

Along with enabling the Service Dependency checkbox, as shown above, you will need to add the below condition to the rule:

<mark style="color:red;">`past_incident.service == <slug_of_the_particular_dependency_service>`</mark>

## FAQs <a href="#faqs" id="faqs"></a>

1\. Where can one find the <mark style="color:red;">`slug`</mark> of a Service?

The <mark style="color:red;">`slug`</mark> of a Service is displayed on the Service card as shown below.

![Service Slug in Squadcast](https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-202a9c11901ac0a8026c4eacbdaf12d93ef91763%2Fservices_new_2.png?alt=media)

2\. Can I set up dependencies between Services that are in 2 different Teams?

No, you can set up dependencies only within Services for a given Team and not across Teams.

*Have any questions?* [*Ask the community*](https://community.squadcast.com/view/home)*.*
