Skip to content
betterstack-alchemyUnofficial

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.

An e-mail-only level for low-urgency alerts:

alchemy.run.ts
const low = yield* BetterStack.Incidents.Severity("low", {
name: "Low",
email: true,
push: false,
sms: false,
call: false,
});

A SeverityGroup keeps related levels together:

alchemy.run.ts
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,
});
alchemy.run.ts
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.

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:

alchemy.run.ts
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.

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:

alchemy.run.ts
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.