Logotipo Hedhog

Get Hedhog updates in your inbox

New releases, fresh recipes, and breaking changes — no spam.

sac Submodule

sla-policies

First-response and resolution targets per priority, with pause on waiting-customer and a scheduled sweep that flags breaches.

Source path: libraries/sac/src/sla

Module file: sla.module.ts

Introduction

A policy carries one target per priority (`sac_sla_target`), so an urgent ticket and a low one answer to different clocks under the same policy. A category may point at its own policy; otherwise the default one applies, and the database enforces a single default through a partial unique index.

`pause_on_waiting_customer` is what keeps the metric honest: time spent waiting on the customer accumulates in `paused_ms` and shifts the deadlines when the customer replies, instead of counting against the team.

A cron every five minutes enqueues a sweep; the sweep itself runs on the queue, so a deployment with several pods does not do the work more than once. It flags tickets that are about to breach (at the configured warning threshold) and those already breached, recording an event on each.

HTTP Endpoints

4 endpoints

Paginated policy list with their targets.

Query
page, pageSize, search

Create a policy with its per-priority targets.

Body

FieldTypeRequiredNotes
slugstringyes
localeRecord<locale, { name }>yes
is_defaultbooleannoOnly one policy can be the default; enforced in the database
pause_on_waiting_customerbooleanno
targetsArray<{ priority, first_response_minutes, resolution_minutes }>no

Update a policy and its targets.

Params
id (int)

Delete a policy.

Params
id (int)