Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: deduplication v2 #1902

Merged
merged 50 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
c646294
feat: wip
shahargl Sep 4, 2024
1aa54a6
feat: wip
shahargl Sep 4, 2024
4a1fdad
feat: Merge branch 'main' into feature/deduplication-v2
shahargl Sep 5, 2024
d1eab71
feat: wip
shahargl Sep 5, 2024
a7811c2
feat: wip
shahargl Sep 5, 2024
a2d0275
feat: Merge branch 'main' into feature/deduplication-v2
shahargl Sep 5, 2024
27d8586
feat: wip
shahargl Sep 6, 2024
c8acbbd
feat: merge from main
shahargl Sep 10, 2024
7370aa5
feat: wip
shahargl Sep 10, 2024
aea3cc6
feat: Merge branch 'main' into feature/deduplication-v2
shahargl Sep 11, 2024
509f6a7
feat: wip
shahargl Sep 11, 2024
109d58b
feat: wip
shahargl Sep 11, 2024
172ece2
feat: Merge branch 'main' into feature/deduplication-v2
shahargl Sep 11, 2024
a19e57d
feat: wip
shahargl Sep 11, 2024
d73fee5
feat: wip"
shahargl Sep 11, 2024
a3d8efb
feat: wip
shahargl Sep 11, 2024
83d50e4
feat: merge from main
shahargl Sep 15, 2024
cbd12e5
feat: wip
shahargl Sep 15, 2024
20f0e15
feat: Merge branch 'main' into feature/deduplication-v2
shahargl Sep 15, 2024
728a72a
feat: wip
shahargl Sep 15, 2024
45dfbd5
feat: wip
shahargl Sep 16, 2024
1330572
feat: Merge branch 'main' into feature/deduplication-v2
shahargl Sep 16, 2024
15cfa6e
feat: wip
shahargl Sep 16, 2024
7276c9e
feat: wip
shahargl Sep 17, 2024
fbeb910
feat: add migration
shahargl Sep 17, 2024
14b8f06
feat: wip
shahargl Sep 17, 2024
29fa6d9
feat: merge from main
shahargl Sep 19, 2024
1eb7e1e
feat: tests
shahargl Sep 19, 2024
0ba7ff5
feat: Merge branch 'main' into feature/deduplication-v2
shahargl Sep 19, 2024
3cfe0ba
feat: done
shahargl Sep 19, 2024
8493436
feat: merge from main
shahargl Sep 23, 2024
14eeb68
feat: merge from main
shahargl Sep 23, 2024
d5da7f5
feat: make ui build pass
shahargl Sep 23, 2024
2857d46
feat: remove redundant tests
shahargl Sep 23, 2024
917cfa6
feat: revert some changes in simualte alert
shahargl Sep 23, 2024
203e9ed
feat: make test pass
shahargl Sep 24, 2024
9dc8ea7
feat: cr
shahargl Sep 24, 2024
ad285a7
feat: tests
shahargl Sep 24, 2024
3d3909c
feat: cr
shahargl Sep 24, 2024
865a137
Merge branch 'main' into feature/deduplication-v2
talboren Sep 24, 2024
bcbca12
feat: merge
shahargl Sep 24, 2024
9e12b02
feat: merge
shahargl Sep 24, 2024
2026040
feat: merge
shahargl Sep 24, 2024
98aa092
feat: order
shahargl Sep 24, 2024
30f4fd2
feat: Merge branch 'main' into feature/deduplication-v2
shahargl Sep 24, 2024
2883c4e
feat: Merge branch 'main' into feature/deduplication-v2
shahargl Sep 25, 2024
efb788e
feat: cr fixes
shahargl Sep 25, 2024
586490b
feat: make build pass again
shahargl Sep 25, 2024
4247ee1
feat: make build pass again
shahargl Sep 25, 2024
c9d8262
feat: revert redundant
shahargl Sep 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -205,4 +205,7 @@ playwright_dump_*.html
playwright_dump_*.png

ee/experimental/ai_temp/*
!ee/experimental/ai_temp/.gitkeep
,e!ee/experimental/ai_temp/.gitkeep

oauth2.cfg
scripts/keep_slack_bot.py
1 change: 1 addition & 0 deletions docs/mint.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
]
},
"overview/maintenance-windows",
"overview/deduplication",
"overview/examples"
]
},
Expand Down
107 changes: 107 additions & 0 deletions docs/overview/deduplication.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
---
title: "Alert Deduplication"
---

## Overview

Alert deduplication is a crucial feature in Keep that helps reduce noise and streamline incident management by grouping similar alerts together. This process ensures that your team isn't overwhelmed by a flood of notifications for what is essentially the same issue, allowing for more efficient and focused incident response.

## Glossary

- **Deduplication Rule**: A set of criteria used to determine if alerts should be grouped together.
- **Partial Deduplication**: Correlates instances of alerts into single alerts, considering the case of the same alert with different statuses (e.g., firing and resolved). This is the default mode where specified fields are used to identify and group related alerts.
- **Fingerprint Fields**: Specific alert attributes used to identify similar alerts.
- **Full Deduplication**: A mode where alerts are considered identical if all fields match exactly (except those explicitly ignored). This helps avoid system overload by discarding duplicate alerts.
shahargl marked this conversation as resolved.
Show resolved Hide resolved
- **Ignore Fields**: In full deduplication mode, these are fields that are not considered when comparing alerts.

## Deduplication Types

### Partial Deduplication
Partial deduplication allows you to specify certain fields (fingerprint fields) that are used to identify similar alerts. Alerts with matching values in these specified fields are considered duplicates and are grouped together. This method is flexible and allows for fine-tuned control over how alerts are deduplicated.

Every provider integrated with Keep comes with pre-built partial deduplication rule tailored to that provider's specific alert format and common use cases.
The default fingerprint fields defined using `FINGERPRINT_FIELDS` attributes in the provider code (e.g. [datadog provider](https://github.com/keephq/keep/blob/main/keep/providers/datadog_provider/datadog_provider.py#L188) or [gcp monitoring provder](https://github.com/keephq/keep/blob/main/keep/providers/gcpmonitoring_provider/gcpmonitoring_provider.py#L52)).

### Full Deduplication
When full deduplication is enabled, Keep will also discard exact same events (excluding ignore fields). This mode considers all fields of an alert when determining duplicates, except for explicitly ignored fields.

By default, exact similar events excluding lastReceived time are fully deduplicated and discarded. This helps prevent system overload from repeated identical alerts.

## Real Examples of Alerts and Results

### Example 1: Partial Deduplication

**Rule** - Deduplicate based on 'service' and 'error_message' fields.

```json
# alert 1
{
"service": "payment",
"error_message": "Database connection failed",
"severity": "high",
"lastReceived": "2023-05-01T10:00:00Z"
}
# alert 2
{
"service": "payment",
"error_message": "Database connection failed",
"severity": "critical",
"lastReceived": "2023-05-01T10:05:00Z"
}
# alert 3
{
"service": "auth",
"error_message": "Invalid token",
"severity": "medium",
"lastReceived": "2023-05-01T10:10:00Z"
}
```

**Result**:
- Alerts 1 and 2 are deduplicated into a single alert, fields are updated.
- Alert 3 remains separate as it has a different service and error message.

### Example 2: Full Deduplication

**Rule**: Full deduplication with 'timestamp' as an ignore field

**Incoming Alerts**:

```json

# alert 1
{
service: "api",
error: "Rate limit exceeded",
user_id: "12345",
lastReceived: "2023-05-02T14:00:00Z"
}
# alert 2 (discarded as its identical)
{
service: "api",
error: "Rate limit exceeded",
user_id: "12345",
lastReceived: "2023-05-02T14:01:00Z"
}
# alert 3
{
service: "api",
error: "Rate limit exceeded",
user_id: "67890",
lastReceived: "2023-05-02T14:02:00Z"
}
```

**Result**:
- Alerts 1 and 2 are deduplicated as they are identical except for the ignored timestamp field.
- Alert 3 remains separate due to the different user_id.

## How It Works

Keep's deduplication process follows these steps:

1. **Alert Ingestion**: Every alert received by Keep is first ingested into the system.

2. **Enrichment**: After ingestion, each alert undergoes an enrichment process. This step adds additional context or information to the alert, enhancing its value and usefulness.

3. **Deduplication**: Following enrichment, Keep's alert deduplicator comes into play. It applies the defined deduplication rules to the enriched alerts.
30 changes: 30 additions & 0 deletions keep-ui/app/deduplication/DeduplicationPlaceholder.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { Fragment, useState } from "react";
import { Button, Card, Subtitle, Title } from "@tremor/react";
// import { CorrelationSidebar } from "./CorrelationSidebar";
shahargl marked this conversation as resolved.
Show resolved Hide resolved
import { DeduplicationSankey } from "./DeduplicationSankey";

export const DeduplicationPlaceholder = () => {
const [isSidebarOpen, setIsSidebarOpen] = useState(false);

const onCorrelationClick = () => {
setIsSidebarOpen(true);
};

return (
<Fragment>
<Card className="flex flex-col items-center justify-center gap-y-8 h-full">
<div className="text-center space-y-3">
<Title className="text-2xl">No Deduplications Yet</Title>
<Subtitle className="text-gray-400">
Reduce noise by creatiing deduplications.
</Subtitle>
<Subtitle className="text-gray-400">
Start sending alerts or connect providers to create deduplication
rules.
</Subtitle>
</div>
<DeduplicationSankey className="max-w-full" />
</Card>
</Fragment>
);
};
88 changes: 88 additions & 0 deletions keep-ui/app/deduplication/DeduplicationSankey.tsx

Large diffs are not rendered by default.

Loading
Loading