Severities & metadata
A Severity is a named alerting level, such
as low or high. It sets how people are alerted, by phone call, SMS, e-mail, push
or critical alert, when an escalation policy
step uses it through severityId. Creating a severity alerts nobody; only an
incident escalated through a step that uses it does.
Create a severity
Section titled “Create a severity”An e-mail-only level for low-urgency alerts:
const low = yield* BetterStack.Incidents.Severity("low", { name: "Low", email: true, push: false, sms: false, call: false,});Group severities
Section titled “Group severities”A SeverityGroup keeps related levels
together:
const paging = yield* BetterStack.Incidents.SeverityGroup("paging", { name: "Paging", sortIndex: 1,});const critical = yield* BetterStack.Incidents.Severity("critical", { name: "Critical", call: true, push: true, criticalAlert: true, severityGroupId: paging.id,});Use a severity in a policy
Section titled “Use a severity in a policy”yield* BetterStack.Incidents.EscalationPolicy("on-call", { name: "On-call", steps: [ { type: "escalation", waitBefore: 0, severityId: critical.id, stepMembers: [{ type: "current_on_call" }], }, ],});A severity referenced by a policy step can’t be deleted until the step changes. The severity live tests that need a policy share the escalation-policy plan gate; see Compatibility.
Tag what you monitor
Section titled “Tag what you monitor”A Metadata entry is a key with values
attached to a monitor, heartbeat, incident or integration (ownerType +
ownerId). Values are strings, or references to catalog items such as an
escalation policy, an on-call schedule, a user or a team:
const site = yield* BetterStack.Incidents.Monitor("site", { url: "https://example.com", monitorType: "status",});yield* BetterStack.Incidents.Metadata("site-owner", { ownerType: "Monitor", ownerId: site.id, key: "Owner", values: [{ type: "String", value: "Platform team" }],});A monitor’s or heartbeat’s own metadata prop writes the same keys: manage each
key in one place only.
Route incidents with the catalog
Section titled “Route incidents with the catalog”The on-call catalog holds tables of your own, such as services and who owns
them. A CatalogRelation is a table
and its columns; CatalogRecords are its
rows. When an incident’s metadata matches a record’s primary attributes, the
incident gets the record’s other attributes as metadata, such as an owner or an
escalation policy:
const services = yield* BetterStack.Incidents.CatalogRelation("services", { name: "Services", description: "Who owns each service", attributes: [{ name: "Service", primary: true }, { name: "Owner" }],});yield* BetterStack.Incidents.CatalogRecord("checkout", { catalogRelationId: services.id, attributes: [ { attribute: { name: "Service" }, values: [{ type: "String", value: "checkout-api" }] }, { attribute: { name: "Owner" }, values: [{ type: "String", value: "Payments team" }] }, ],});attributes sent on update replaces every column: a column you leave out is
removed with its values in every record. The catalog needs a paid plan; its live
test is gated for that reason.
Where next
Section titled “Where next”- Escalation policies: where severities are used.
- Reference:
Severity,SeverityGroup,Metadata,CatalogRelation,CatalogRecord. - Better Stack: Severities (API), Metadata (API), Catalog relations (API).