Skip to content

Statistics of a set of triggers, per trigger

GET
/stats
curl --request GET \
--url 'https://localhost:3000/api/v1/stats?by=example' \
--header 'Authorization: <Authorization>'

Returns the stats buckets of several triggers in one call (list sparklines). by=trigger is required (without it: 400). Exactly one scope parameter: owner (personal or tenant:{id}, same triggers as GET /triggers?owner=, without triggers shared through access), scope=all (personal, organizations and shared triggers), group_id, or trigger_ids (50 max). No scope parameter, or several: 400. Triggers the caller cannot read are ignored; trigger_ids returns skipped_trigger_ids (nonexistent and forbidden cannot be told apart). An inaccessible owner or group: 404. An API key must carry trigger:stats on every trigger, and tenant:read:{id} for an organization’s triggers. Buckets are those of GET /triggers/{id}/stats (same intervals, same alignment, only non-empty buckets, 10000 max per trigger); a readable trigger without events has buckets=[]. Window bounded to 30 days (an older from is brought back to to - 30 days). More than 200000 buckets in total: 400. Beyond 10000 triggers (scope=all) or 500 (other scopes) the response carries truncated=true and covers the oldest triggers. Public triggers of another owner, read only through their public visibility, reject a filter on a _ key (400) for the whole call.

owner
string

Scope: personal or tenant:{id}

scope
string

Scope: all

group_id
string

Scope: group ID (UUID)

trigger_ids
string

Scope: comma-separated trigger IDs (50 max)

by
required
string

Regroupement: trigger

from
string

Start (default: now-1h). Supports relative time: now-1h, now-24h

to
string

End (default: now). Supports relative time

interval
string

Bucket interval (default: 1m). E.g. 1m, 5m, 1h, 1d

filter
string

JSON filter on metadata

Buckets per trigger

Media typeapplication/json
object
skipped_trigger_ids
required

SkippedTriggerIDs lists the requested trigger_ids that do not exist or that the caller may not read (the two cases are not told apart). Empty for the other scopes.

Array<string>
triggers
required

Triggers is keyed by trigger ID. A readable trigger without events has empty buckets.

object
key
additional properties
object
buckets
required

Buckets holds only the time buckets that contain events, in time order.

Array<object>
object
count
required

Count is the number of events (with measure=sum:, of those carrying a numeric key).

integer
time
required
string
value

Value is the sum of the key over the bucket, present with measure=sum: only.

number
truncated
required

Truncated is true when the scope holds more readable triggers than the cap (10000 for scope=all, 500 otherwise): only the oldest ones are read.

boolean

Example

{
"skipped_trigger_ids": [
"550e8400-e29b-41d4-a716-446655440000"
],
"triggers": {
"additionalProperty": {
"buckets": [
{
"count": 152,
"time": "2024-01-15T10:00:00Z",
"value": 1.25
}
]
}
},
"truncated": false
}

Invalid request

Media typeapplication/json
object
error
required
string
message
string

Example

{
"error": "invalid_request",
"message": "Invalid request body"
}

Unauthorized

Media typeapplication/json
object
error
required
string
message
string

Example

{
"error": "invalid_request",
"message": "Invalid request body"
}

Owner or group not found

Media typeapplication/json
object
error
required
string
message
string

Example

{
"error": "invalid_request",
"message": "Invalid request body"
}

Too many concurrent calls

Media typeapplication/json
object
error
required
string
message
string

Example

{
"error": "invalid_request",
"message": "Invalid request body"
}

Erreur interne

Media typeapplication/json
object
error
required
string
message
string

Example

{
"error": "invalid_request",
"message": "Invalid request body"
}

Timeout

Media typeapplication/json
object
error
required
string
message
string

Example

{
"error": "invalid_request",
"message": "Invalid request body"
}