Skip to content

Commit

Permalink
chore: added comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Nav-aggarwal09 committed Feb 16, 2021
1 parent ef8ced7 commit 344e1ef
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions influxdb2_operational_monitoring/influxdb2_cardinality_now.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,24 @@ spec:
associations:
- kind: Label
name: determined-torvalds-b69001
every: 1d
every: 1h
name: 'Cardinality Alert '
offset: 20m0s
query: |-
import "influxdata/influxdb"
import "slack"
// TODO: create a slack notification endpoint and paste link here
// documentation: https://docs.influxdata.com/influxdb/v2.0/monitor-alert/notification-endpoints/create/
slackWebhook = "https://hooks.slack.com/services/XXXX/XXXX/XXXXX"
// TODO: specify the channel based on the webhook
slackChannel = "##"
// default cardinality
cardinalityThreshold = 1000000
alert = (bucketCard, bucketName) =>
(if bucketCard >= cardinalityThreshold then () =>
(slack.message(
Expand All @@ -38,7 +44,7 @@ spec:
buckets()
|> map(fn: (r) => {
cards = influxdb.cardinality(start: -1d, bucket: r.name)
cards = influxdb.cardinality(start: -1h, bucket: r.name)
|> findRecord(idx: 0, fn: (key) =>
(true))
result = alert(bucketCard: cards._value, bucketName: r.name)
Expand Down

0 comments on commit 344e1ef

Please sign in to comment.