Skip to content

Alerting: Linear as a destination type, opening one issue per incident #1896

Closed

Description

@jasonkuhrt

Written by an AI agent (Claude) on behalf of @jasonkuhrt.

A team that tracks its work in Linear can't send Maple alerts there. Linear isn't a destination type, so getting an incident into Linear means writing and hosting your own webhook endpoint.

Here's what that takes today. It's the Worker we're about to build for Heartbeat:

// Behind a `webhook` destination. Check x-maple-signature first.
// Linear accepts a caller-chosen UUID on create, so ids derived from
// incidentId and x-maple-delivery-key make Maple's retries harmless.
switch (body.eventType) {
	case "trigger":
		// Linear issueCreate in the team's Triage, id = uuid(incidentId).
	case "renotify":
	case "resolve":
		// Linear commentCreate on issue uuid(incidentId),
		// id = uuid(x-maple-delivery-key).
	case "test":
		// nothing
}

It also needs a Linear API key in the Worker's secrets, so every issue shows the key's owner as its creator, not Maple.

What we'd like to write instead, after connecting Linear once in Maple's integrations the way Slack is connected:

yield* Maple.AlertDestination("linear", {
	type: "linear",
	name: "Engineering triage",
	team_id: "…", // the Linear team whose Triage receives the issues
})

Maple would then open one issue per incident in that team, comment on it at renotify and resolve, link it back to the incident, and show itself as the issue's creator.

Linear's own Sentry integration is the precedent (https://linear.app/docs/sentry). Sentry alert rules can create Linear issues, a Sentry issue can link to a Linear issue, and completing the Linear issue resolves the Sentry one. Maple's error issues could work the same way: create or link a Linear issue from an error issue, and move the error issue to resolved when its Linear issue completes.

One related gap: the webhook reference describes linkUrl as "the incident in the Maple dashboard", but composeLinkUrl in packages/backend/src/services/alerts/AlertDestinationDelivery.ts builds /services/<name>, the same URL for every incident of a service. That's why the Worker above keys on incidentId, and its issue can only link to the service page.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions