Skip to content
Open
Changes from all commits
Commits
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
28 changes: 22 additions & 6 deletions k8s/manifests/kube-prometheus/lib/sendgrid.libsonnet
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@

local addMixin = (import 'kube-prometheus/lib/mixin.libsonnet');

local urls = import './endpoint-urls.libsonnet';

local prometheusRules = {
Expand All @@ -12,7 +10,11 @@ local prometheusRules = {
{
alert: 'SendGridEmailRemainingLow',
expr: |||
sendgrid_email_used_count{account_name!="ethiopia_production"} > 0.95 * sendgrid_email_limit_count{account_name!="ethiopia_production"}
(
sendgrid_email_used_count > 0.95 * sendgrid_email_limit_count
)
and
account_name != "ethiopia_production"
|||,
'for': '5m',
labels: {
Expand All @@ -26,7 +28,13 @@ local prometheusRules = {
{
alert: 'SendGridEmailRemainingZero',
expr: |||
sendgrid_email_remaining_count{account_name!="ethiopia_production"} < 1 or absent(sendgrid_email_remaining_count{account_name!="ethiopia_production"})
(
sendgrid_email_remaining_count < 1
or
absent(sendgrid_email_remaining_count)
)
and
account_name != "ethiopia_production"
|||,
'for': '5m',
labels: {
Expand All @@ -40,7 +48,13 @@ local prometheusRules = {
{
alert: 'SendGridPlanExpired',
expr: |||
sendgrid_plan_expiration_seconds{account_name!="ethiopia_production"} < 1 or absent(sendgrid_plan_expiration_seconds{account_name!="ethiopia_production"})
(
sendgrid_plan_expiration_seconds < 1
or
absent(sendgrid_plan_expiration_seconds)
)
and
account_name != "ethiopia_production"
|||,
'for': '5h',
labels: {
Expand All @@ -54,7 +68,9 @@ local prometheusRules = {
{
alert: 'SendGridServiceUnreachable',
expr: |||
sendgrid_monitoring_http_return_code{account_name!="ethiopia_production"} != 200
sendgrid_monitoring_http_return_code != 200
and
account_name != "ethiopia_production"
|||,
'for': '1h',
labels: {
Expand Down