Alerts come from alert rules: a query over the metrics Streamtime collects, and how long it must hold before the alert fires. Every fleet and every workload gets a set of built-in rules, and you can change them or add your own.
Rules for
Built-in rules cover
Where in the console
A fleet
Kubernetes and the fleet’s shared services: nodes, pods, storage, monitoring
The fleet’s Monitoring cards → Alert Rules
A Kafka cluster (Apache Kafka, Confluent, WarpStream)
Brokers and partitions: free disk space, under-replicated and offline partitions, controller state, and more
The cluster’s Monitoring cards → Alert Rules
A ClickHouse cluster
Instances down, disk space, replication lag, and more
The cluster’s Monitoring cards → Alert Rules
A Flink deployment (Apache Flink)
Jobs restarting, failing or slow checkpoints, no free task slots, memory pressure
The API only, for now
An alert that fires shows in the console and goes to the fleet’s alert channels. With email set up, the person who created the resource is emailed too.
A rule
Field
What it is
Alert name
Starts with a letter; letters, digits and underscores only. Unique within the resource’s rules
Rule group
Rules are grouped; a new rule goes in the resource’s default group
PromQL expression
The condition. The alert fires for every series the query returns
For duration
How long the condition must hold first, for example 5m
Severity
critical or warning by convention; your alert channels can route on it
Enabled
Turn a rule off without deleting it
Rules marked Default are built in; rules you add are Custom. You can edit or turn off a built-in rule. Reset defaults puts the built-in rules back as Streamtime ships them, and leaves your custom rules alone.
Sync
Rules are saved in Streamtime and synced to the cluster that evaluates them. Changes sync automatically. The panel shows Syncing to cluster while that runs, Sync required when the cluster’s rules differ from what is saved, and Apply failed with the reason when the cluster refused them. Sync to cluster syncs again.
packagemainimport("bytes""crypto/rand""encoding/hex""encoding/json""net/http""os")constapi="https://api.example.com/organizations/<org>"// newKey returns a random idempotency key.funcnewKey()string{b:=make([]byte,16)rand.Read(b)returnhex.EncodeToString(b)}// call sends one request with the access token and a JSON body (or none).// An optional idempotency key is sent as the Idempotency-Key header.funccall(method,pathstring,bodyany,idempotencyKey...string)(*http.Response,error){varbufbytes.Bufferifbody!=nil{iferr:=json.NewEncoder(&buf).Encode(body);err!=nil{returnnil,err}}req,err:=http.NewRequest(method,api+path,&buf)iferr!=nil{returnnil,err}req.Header.Set("Authorization","Bearer "+os.Getenv("STREAMTIME_TOKEN"))req.Header.Set("Content-Type","application/json")iflen(idempotencyKey)>0{req.Header.Set("Idempotency-Key",idempotencyKey[0])}returnhttp.DefaultClient.Do(req)}
Add a rule
Paths below are for a fleet. For a Kafka cluster use /kafka/<cluster>/alert-rules/, for ClickHouse /clickhouses/<cluster>/alert-rules/, and for Flink /flink/<deployment>/alert-rules/.
Open the fleet or cluster, go to its Monitoring cards and choose Alert Rules.
Select Add rule.
Enter Alert name, PromQL expression, For duration and Severity; keep or change the Rule group; leave Enabled on.
Save. The rule appears as Custom and syncs to the cluster.
# Check it first: the expression must parse.
curl -X POST "$API/fleet/<fleet>/alert-rules/validate/"\-H"Authorization: Bearer $STREAMTIME_TOKEN"-H"Content-Type: application/json"\-d'{"alertname": "NodeDiskAlmostFull", "rule_group": "custom.rules",
"expr": "node_filesystem_avail_bytes / node_filesystem_size_bytes < 0.1",
"for_duration": "10m", "labels": {"severity": "warning"},
"annotations": {"summary": "A node disk is almost full"}}'# Add it.
curl -X POST "$API/fleet/<fleet>/alert-rules/"\-H"Authorization: Bearer $STREAMTIME_TOKEN"-H"Content-Type: application/json"\-d'{"alertname": "NodeDiskAlmostFull", "rule_group": "custom.rules",
"expr": "node_filesystem_avail_bytes / node_filesystem_size_bytes < 0.1",
"for_duration": "10m", "labels": {"severity": "warning"},
"annotations": {"summary": "A node disk is almost full"}}'
Other requests on the same path:
Request
Does
GET …/alert-rules/
The rules and the sync state (apply_status, last_apply_error)
PATCH …/alert-rules/<alertname>/
Change a rule, for example {"enabled": false}
DELETE …/alert-rules/<alertname>/
Remove a custom rule
POST …/alert-rules/reset-defaults/
Put the built-in rules back
POST …/alert-rules/apply/
Sync to the cluster now
GET …/alert-rules/status/
Whether a sync is pending, and its message
The generated SDK doesn’t describe these request bodies yet, so send them with the SDK’s HTTP client: