Skip to content

Commit

Permalink
feat: dash0 provider
Browse files Browse the repository at this point in the history
  • Loading branch information
ezhil56x committed Feb 3, 2025
1 parent bbbd831 commit df77505
Show file tree
Hide file tree
Showing 19 changed files with 243 additions and 8 deletions.
22 changes: 14 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,20 +179,26 @@
Coralogix
</a>
</td>
<td align="center" width="150">
<a href="https://docs.keephq.dev/providers/documentation/dash0-provider" target="_blank">
<img width="40" src="keep-ui/public/icons/dash0-icon.png" alt="Dash0"/><br/>
Dash0
</a>
</td>
<td align="center" width="150">
<a href="https://docs.keephq.dev/providers/documentation/datadog-provider" target="_blank">
<img width="40" src="keep-ui/public/icons/datadog-icon.png" alt="Datadog"/><br/>
Datadog
</a>
</td>
</tr>
<tr>
<td align="center" width="150">
<a href="https://docs.keephq.dev/providers/documentation/dynatrace-provider" target="_blank">
<img width="40" src="keep-ui/public/icons/dynatrace-icon.png" alt="Dynatrace"/><br/>
Dynatrace
</a>
</td>
</tr>
<tr>
<td align="center">
<a href="https://docs.keephq.dev/providers/documentation/elastic-provider" target="_blank">
<img width="40" src="keep-ui/public/icons/elastic-icon.png" alt="Elastic"/><br/>
Expand Down Expand Up @@ -223,14 +229,14 @@
Kibana
</a>
</td>
</tr>
<tr>
<td align="center" width="150">
<a href="https://docs.keephq.dev/providers/documentation/netdata-provider" target="_blank">
<img width="40" src="keep-ui/public/icons/netdata-icon.png" alt="Netdata"/><br/>
Netdata
</a>
</td>
</tr>
<tr>
<td align="center" width="150">
<a href="https://docs.keephq.dev/providers/documentation/new-relic-provider" target="_blank">
<img width="40" src="keep-ui/public/icons/newrelic-icon.png" alt="New Relic"/><br/>
Expand Down Expand Up @@ -261,14 +267,14 @@
Rollbar
</a>
</td>
</tr>
<tr>
<td align="center" width="150">
<a href="https://docs.keephq.dev/providers/documentation/sentry-provider" target="_blank">
<img width="40" src="keep-ui/public/icons/sentry-icon.png" alt="Sentry"/><br/>
Sentry
</a>
</td>
</tr>
<tr>
<td align="center" width="150">
<a href="https://docs.keephq.dev/providers/documentation/signalfx-provider" target="_blank">
<img width="40" src="keep-ui/public/icons/signalfx-icon.png" alt="SignalFX"/><br/>
Expand Down Expand Up @@ -299,14 +305,14 @@
StatusCake
</a>
</td>
</tr>
<tr>
<td align="center" width="150">
<a href="https://docs.keephq.dev/providers/documentation/sumologic-provider" target="_blank">
<img width="40" src="keep-ui/public/icons/sumologic-icon.png" alt="SumoLogic"/><br/>
SumoLogic
</a>
</td>
</tr>
<tr>
<td align="center" width="150">
<a href="https://docs.keephq.dev/providers/documentation/uptimekuma-provider" target="_blank">
<img width="40" src="keep-ui/public/icons/uptimekuma-icon.png" alt="UptimeKuma"/><br/>
Expand Down
6 changes: 6 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ services:
file: docker-compose.common.yml
service: keep-frontend-common
environment:
- AUTH_TYPE=DB
- API_URL=http://keep-backend-dev:8080
- SENTRY_DISABLED=true
build:
Expand All @@ -21,6 +22,11 @@ services:
service: keep-backend-common
build:
dockerfile: docker/Dockerfile.dev.api
environment:
- AUTH_TYPE=DB
- KEEP_JWT_SECRET=verysecretkey
- KEEP_DEFAULT_USERNAME=keep
- KEEP_DEFAULT_PASSWORD=keep
volumes:
- .:/app
- ./state:/state
Expand Down
Binary file added docs/images/dash0-provider_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/dash0-provider_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/dash0-provider_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/dash0-provider_4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/dash0-provider_5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/dash0-provider_6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/keep-apikey-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/keep-apikey-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/keep-apikey-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/keep-apikey-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/mint.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
"providers/documentation/cloudwatch-provider",
"providers/documentation/console-provider",
"providers/documentation/coralogix-provider",
"providers/documentation/dash0-provider",
"providers/documentation/datadog-provider",
"providers/documentation/deepseek-provider",
"providers/documentation/discord-provider",
Expand Down
84 changes: 84 additions & 0 deletions docs/providers/documentation/dash0-provider.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
---
title: 'Dash0'
sidebarTitle: 'Dash0 Provider'
description: 'Dash0 provider allows you to get events from Dash0 using webhooks.'
---

## Overview

Dash0 is modern OpenTelemetry Native Observability, built on CNCF Open Standards such as PromQL, Perses and OTLP with full cost control.

## Connecting Dash0 to Keep

To connect Dash0 to Keep, you need to create a webhook in Dash0.

1. Go to Dash0 dashboard and click on Organization settings.

<Frame width="100" height="200">
<img height="10" src="/images/dash0-provider_1.png" />
</Frame>

2. Click on `Notification Channels` and create a New notification channel of type `Webhook`.

<Frame width="100" height="200">
<img height="10" src="/images/dash0-provider_2.png" />
</Frame>

3. Give a name to the webhook and enter [https://api.keephq.dev/alerts/event/dash0](https://api.keephq.dev/alerts/event/dash0) as the URL.

4. Follow the below steps to create a new API key in Keep.

5. Go to Keep dashboard and click on the profile icon in the botton left corner and click `Settings`.

<Frame width="100" height="200">
<img height="10" src="/images/keep-apikey-1.png" />
</Frame>

6. Select `Users and Access` tab and then select `API Keys` tab and create a new API key.

<Frame width="100" height="200">
<img height="10" src="/images/keep-apikey-2.png" />
</Frame>

7. Give name and select the role as `webhook` and click on `Create API Key`.

<Frame width="100" height="200">
<img height="10" src="/images/keep-apikey-3.png" />
</Frame>

8. Copy the API key.

<Frame width="100" height="200">
<img height="10" src="/images/keep-apikey-4.png" />
</Frame>

9. Add a new request header with key `X-API-KEY` and value as the API key copied from Keep and save the webhook.

<Frame width="100" height="200">
<img height="10" src="/images/dash0-provider_3.png" />
</Frame>

10. Go to `Notifications` under `Alerting` and create a new notification rule if required or change the existing notification rule to use the webhook created.

<Frame width="100" height="200">
<img height="10" src="/images/dash0-provider_4.png" />
</Frame>

11. Go to `Checks` under `Alerting` and create a new check or edit an existing check to use the notification rule created.

<Frame width="100" height="200">
<img height="10" src="/images/dash0-provider_5.png" />
</Frame>

<Frame width="100" height="200">
<img height="10" src="/images/dash0-provider_6.png" />
</Frame>

12. Now you will start receiving events in Keep from Dash0.

## Useful Links

- [Dash0](https://dash0.com/)



6 changes: 6 additions & 0 deletions docs/providers/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@ By leveraging Keep Providers, users are able to deeply integrate Keep with the t
icon={ <img src="https://img.logo.dev/coralogix.com?token=pk_dfXfZBoKQMGDTIgqu7LvYg" /> }
></Card>

<Card
title="Dash0"
href="/providers/documentation/dash0-provider"
icon={ <img src="https://img.logo.dev/dash0.com?token=pk_dfXfZBoKQMGDTIgqu7LvYg" /> }
></Card>

<Card
title="Datadog"
href="/providers/documentation/datadog-provider"
Expand Down
Binary file added keep-ui/public/icons/dash0-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
51 changes: 51 additions & 0 deletions keep/providers/dash0_provider/alerts_mock.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
ALERTS = {
"type": "alert.resolved",
"data": {
"issue": {
"id": "b9a9da0b-7a79-4a1d-abf3-5cd07649e80a",
"issueIdentifier": "6820705469291328438",
"dataset": "default",
"start": "2025-02-03T07:17:17.474101621Z",
"end": "2025-02-03T07:24:17.474101621Z",
"status": "resolved",
"summary": "This is a summay",
"description": "This is a description",
"labels": [
{
"key": "service.name",
"value": {
"stringValue": "my-first-observable-service"
}
},
{
"key": "dash0.resource.name",
"value": {
"stringValue": "my-first-observable-service"
}
}
],
"annotations": [],
"checkrules": [
{
"id": "97daff98-e694-421d-abda-d53b23ccfd41",
"version": 1,
"name": "New Check Rule",
"expression": "increase({otel_metric_name = \"dash0.logs\"}[5m]) >= $__threshold",
"thresholds": {
"degraded": 1,
"failed": 5
},
"interval": "1m0s",
"for": "0s",
"keepFiringFor": "0s",
"summary": "This is a summay",
"description": "This is a description",
"labels": {},
"annotations": {},
"url": "https://app.dash0.com/alerting/check-rules?org=477cb1f5-90ca-404e-8533-7a1907b58669&s=eJxljU0OwiAUhO_y1sW-0tYKB_AA6sodhYcSsU34WTXcXerKxOXMN19mgxbkBjasb5DAkY8MOcP-hpPsuEQ8IOIdGkjrH-fihxuVVKRUR4asyj5BaaBVnkJyy6PVT9IvFrKnuP9946WmK3nSya3L3jpTdTEZZa04MTqKgQ28M0zNRjEz9jPvtbZm6Oqfi-fsfdSBqLopZCqlfADAkT0J"
}
],
"url": "https://app.dash0.com/alerting/failed-checks?org=477cb1f5-90ca-404e-8533-7a1907b58669&s=eJxlT71uwyAQfhfmEJ8xNoY36NIuVYduhzlaFMdUgNMh8rsXqg6Vst3p-7-zjpk78ylemWECxMhBcBheQZleGIAzALyzEyvxARf6H-6wYKZSSY487mthx4l1uFIqYfvoPIaVHF8-abnklpiDI4upnSHnnZ5clVqN2iFYrlBpLrF3HK0f-Lg4UJPUNAPWrD8BbSX4QNWDTbMABaOctND9IGY5zK1zuNKLf46NtmAJcXvcIE2vzlLJ341oKyHeKN0CfbcBjkotnt_aW5vGL6oWJe10HMcPHhhbwg%3D%3D"
}
}
}
81 changes: 81 additions & 0 deletions keep/providers/dash0_provider/dash0_provider.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
"""
Dash0 Provider allows to receive alerts from Dash0 using Webhook.
"""

from keep.api.models.alert import AlertDto, AlertSeverity, AlertStatus
from keep.contextmanager.contextmanager import ContextManager
from keep.providers.base.base_provider import BaseProvider
from keep.providers.models.provider_config import ProviderConfig

class Dash0Provider(BaseProvider):
"""
Get alerts from Dash0 into Keep.
"""

webhook_description = ""
webhook_template = ""
webhook_markdown = """
💡 For more details on how to configure Dash0 to send alerts to Keep, see the [Keep documentation](https://docs.keephq.dev/providers/documentation/dash0-provider).
To send alerts from Dash0 to Keep, Use the following webhook url to configure Dash0 send alerts to Keep:
1. In Dash0, go to Organization settings.
2. Go to Notification Channels and create a New notification channel with type Webhook.
3. Give a name to the notification channel and use {keep_webhook_api_url} as the URL.
4. Add a request header with the key "x-api-key" and the value as {api_key}.
5. Save the configuration.
6. Go to Notifications under Alerting in the left sidebar and create a New notification rule if required or change the Notification channel to webhook created in step 3 for an existing Notification Rule.
7. Go to Checks under Alerting in the left sidebar and create a New Check Rule according to your requirements and assign the Notification Rule.
"""

STATUS_MAP = {
"critical": AlertStatus.FIRING,
"degraded": AlertStatus.FIRING,
"resolved": AlertStatus.RESOLVED,
}

# Dash0 doesn't have severity levels, so we map status to severity levels manually.
SEVERITIES_MAP = {
"critical": AlertSeverity.CRITICAL,
"degraded": AlertSeverity.WARNING,
"resolved": AlertSeverity.INFO,
}

PROVIDER_DISPLAY_NAME = "Dash0"
PROVIDER_TAGS = ["alert"]
PROVIDER_CATEGORY = ["Monitoring"]

def __init__(
self, context_manager: ContextManager, provider_id: str, config: ProviderConfig
):
super().__init__(context_manager, provider_id, config)

def validate_config(self):
"""
Validates required configuration for Dash0's provider.
"""
pass

@staticmethod
def _format_alert(
event: dict, provider_instance: "BaseProvider" = None
) -> AlertDto:
alert = AlertDto(
id=event["data"]["issue"]["id"],
name=event["type"],
description=event["data"]["issue"]["description"],
summary=event["data"]["issue"]["summary"],
url=event["data"]["issue"]["url"],
status=Dash0Provider.STATUS_MAP[event["data"]["issue"]["status"]],
severity=Dash0Provider.SEVERITIES_MAP[event["data"]["issue"]["status"]],
lastReceived=event["data"]["issue"].get("end", event["data"]["issue"]["start"]),
startedAt=event["data"]["issue"]["start"],
labels=event["data"]["issue"]["labels"],
checkrules=event["data"]["issue"]["checkrules"],
source=["dash0"],
)

return alert

if __name__ == "__main__":
pass

0 comments on commit df77505

Please sign in to comment.