Skip to content
v1
Docs

API reference

Metric sources

The sources that send custom metrics: their tokens, their settings and the tags they apply.

Its operations need the scopes custom_metrics.edit, custom_metrics.view or custom_metrics.delete.

The Metric source object

Attributes

  • uuidstring

    The source’s uuid.

  • namestring

    The source’s name.

  • slugstring

    The source’s slug, its identifier within the organisation.

  • descriptionstring or null

    The source’s description; null for none.

  • source_typestring

    The source’s type: custom_source; an open set.

  • health_statusstring

    One of unknown, healthy, warning, critical.

  • last_received_atinteger or null

    Epoch milliseconds. When a point last arrived; null if none ever did.

    An instant: epoch milliseconds, UTC.
  • activeboolean

    Whether the source is switched on.

  • has_ingest_tokenboolean

    Whether a usable ingest token exists: a source created and not yet given one, or whose token was revoked, accepts no pushes.

  • ingest_token_last_fourstring or null

    The last four characters of the token; never the token.

  • ingest_token_created_atinteger or null

    Epoch milliseconds. When the ingest token was minted; null if none was.

    An instant: epoch milliseconds, UTC.
  • ingest_token_revoked_atinteger or null

    Epoch milliseconds. When the ingest token was revoked; null otherwise.

    An instant: epoch milliseconds, UTC.
  • custom_metrics_countinteger

    How many metrics the source owns.

  • max_requests_per_minuteinteger

    The request limit in force: the source’s own, else the organisation’s.

  • created_atinteger or null

    Epoch milliseconds. When the source was created.

    An instant: epoch milliseconds, UTC.
  • tagsarray of objects

    The source’s own tags.

  • linked_serversarray of objects or null

    The servers the source’s metrics are linked to directly; null without servers.view, the count kept.

  • linked_servers_countinteger

    How many servers the source’s metrics are linked to directly; given even when linked_servers is null.

  • linked_server_all_tagsarray of objects

    Servers must carry ALL of these tags.

  • linked_server_any_tagsarray of objects

    Servers must carry ANY of these tags.

  • shown_on_servers_countinteger

    How many servers the source’s metrics are shown on.

  • shown_on_serversarray of objects or null

    The first servers they are shown on; null without servers.view.

  • shown_metrics_countinteger

    How many of the source’s metrics are shown (approved and switched on).

Create a metric source

POST/v1/metric-sources

Creates a metric source with no ingest token; mint one with the rotate-token operation. The slug defaults to a slug of the name and cannot be changed afterwards. The call is refused when the plan does not allow it.

Needs the scope custom_metrics.edit.

Headers

  • Idempotency-KeystringOptional

    Any text of 1 to 255 visible ASCII characters. A repeat of the same request within 24 hours returns the first answer without running again (the response carries Idempotent-Replayed: true); the same key on a different request is refused 422 invalid_request.

Body parameters

  • namestringRequired

    The source’s display name.

  • slugstring or nullOptional

    The source’s slug, a lowercase identifier of letters, digits, ., _ and - up to 100 characters; defaults to a slug of the name and cannot be changed afterwards.

  • descriptionstring or nullOptional

    A description of the source, up to 2000 characters; null for none.

  • source_typestring or nullOptional

    The source’s type: custom_source, the one type that can be created.

    Values:custom_source(an open set: new values may be added)
  • activeboolean or nullOptional

    Whether the source is switched on.

  • tag_uuidsarray of stringsOptional

    The uuids of the tags to put on the source, at most 100; null is refused.

Returns

201 Created:

The created metric source.

Each failure is a problem document with a stable code; the response panel's status selector shows each one this operation can answer, and errors lists them all.

Update a metric source

PUT/v1/metric-sources/{metric_source_uuid}

Changes the fields sent: name, description, request limit, whether it is switched on, tags and linked servers. Tags can also be applied to the source’s metrics with apply_tags_to_metrics. A request limit equal to the one in force is not stored, so the source keeps following the organisation’s.

Needs the scope custom_metrics.edit.

Headers

  • Idempotency-KeystringOptional

    Any text of 1 to 255 visible ASCII characters. A repeat of the same request within 24 hours returns the first answer without running again (the response carries Idempotent-Replayed: true); the same key on a different request is refused 422 invalid_request.

Path parameters

  • metric_source_uuidstring (uuid)Required

    The uuid of the metric source in the path.

Body parameters

  • namestring or nullOptional

    The source’s display name.

  • descriptionstring or nullOptional

    A description of the source, up to 2000 characters; null for none.

  • max_requests_per_minuteinteger or nullOptional

    The source’s own limit of ingest requests a minute, from 1 to 100000; a value equal to the limit in force is not stored, so the source keeps following the organisation’s.

  • activeboolean or nullOptional

    Whether the source is switched on.

  • tag_uuidsarray of stringsOptional

    The uuids of the tags to put on the source, at most 100; required when apply_tags_to_metrics is true or tags_before_uuids is sent, and an empty list clears them.

  • apply_tags_to_metricsboolean or nullOptional

    Whether the tag change is also applied to the source’s metrics; when true, tag_uuids and tags_before_uuids are required.

  • tags_before_uuidsarray of stringsOptional

    The uuids of the tags the source carried when the change was prepared, at most 100; required when apply_tags_to_metrics is true, and used to detect that its tags have changed since.

  • linked_server_uuidsarray of strings or nullOptional

    The uuids of the servers the source’s metrics are shown on, at most 100; an empty list clears them and omitting the key keeps them.

  • linked_server_all_tag_uuidsarray of strings or nullOptional

    The uuids of server tags a server must ALL carry for the source’s metrics to be shown on it, at most 20; an empty list clears them and omitting the key keeps them.

  • linked_server_any_tag_uuidsarray of strings or nullOptional

    The uuids of server tags a server must carry at least ONE of for the source’s metrics to be shown on it, at most 20; an empty list clears them and omitting the key keeps them.

Returns

200 OK:

The metric source after the update.

Each failure is a problem document with a stable code; the response panel's status selector shows each one this operation can answer, and errors lists them all.

Get a metric source

GET/v1/metric-sources/{metric_source_uuid}

Returns one metric source with its tags, linked servers and the servers its metrics are shown on. The token is never returned. Server names are given only to a key holding servers.view; without it they are null and the counts are kept.

Needs the scope custom_metrics.view.

Path parameters

  • metric_source_uuidstring (uuid)Required

    The uuid of the metric source in the path.

Returns

200 OK:

The metric source.

Each failure is a problem document with a stable code; the response panel's status selector shows each one this operation can answer, and errors lists them all.

List metric sources

GET/v1/metric-sources

Returns the organisation’s metric sources. A source’s token is never returned, only whether one is set and its last four characters. Pages by page and per_page (limit is the same as per_page); every page carries current_page, per_page, last_page and total.

Needs the scope custom_metrics.view.

Query parameters

  • limitinteger or nullOptional

    The same as per_page, kept for existing clients.

  • include_totalstring or nullOptional

    Ignored: total is always present.

    Values:truefalse10(an open set: new values may be added)
  • per_pageinteger or nullOptional

    The page size, from 1 to 100.

  • pageinteger or nullOptional

    The page to read, from 1; 1 when omitted. A page past the last answers no rows.

Returns

200 OK:

One page of the organisation’s metric sources.

Each item of the page:

  • uuidstring

    The source’s uuid.

  • namestring

    The source’s name.

  • slugstring

    The source’s slug, its identifier within the organisation.

  • descriptionstring or null

    The source’s description; null for none.

  • source_typestring

    The source’s type: custom_source; an open set.

  • health_statusstring

    One of unknown, healthy, warning, critical.

  • last_received_atinteger or null

    Epoch milliseconds. When a point last arrived; null if none ever did.

    An instant: epoch milliseconds, UTC.
  • activeboolean

    Whether the source is switched on.

  • has_ingest_tokenboolean

    Whether a usable ingest token exists: a source created and not yet given one, or whose token was revoked, accepts no pushes.

  • ingest_token_last_fourstring or null

    The last four characters of the token; never the token.

  • custom_metrics_countinteger

    How many metrics the source owns.

  • tagsarray of objects

    The source’s own tags.

Each failure is a problem document with a stable code; the response panel's status selector shows each one this operation can answer, and errors lists them all.

Delete a metric source

DELETE/v1/metric-sources/{metric_source_uuid}

Deletes the metric source. The answer has no body.

Needs the scope custom_metrics.delete.

Headers

  • Idempotency-KeystringOptional

    Any text of 1 to 255 visible ASCII characters. A repeat of the same request within 24 hours returns the first answer without running again (the response carries Idempotent-Replayed: true); the same key on a different request is refused 422 invalid_request.

Path parameters

  • metric_source_uuidstring (uuid)Required

    The uuid of the metric source in the path.

Returns

204 No Content:

The metric source was deleted; there is no body.

Each failure is a problem document with a stable code; the response panel's status selector shows each one this operation can answer, and errors lists them all.

Preview a metric source's tag changes

POST/v1/metric-sources/{metric_source_uuid}/preview-tag-changes

Shows what replacing the source’s tags with tag_uuids would do to its metrics: how many would change, each tag added or removed with its counts, and the first metrics that would change. Nothing is written. When tags_before_uuids is sent and the source’s tags are no longer those, the call is refused.

Needs the scope custom_metrics.edit.

Headers

  • Idempotency-KeystringOptional

    Any text of 1 to 255 visible ASCII characters. A repeat of the same request within 24 hours returns the first answer without running again (the response carries Idempotent-Replayed: true); the same key on a different request is refused 422 invalid_request.

Path parameters

  • metric_source_uuidstring (uuid)Required

    The uuid of the metric source in the path.

Body parameters

  • tag_uuidsarray of stringsRequired

    The uuids of the tags the source would carry after the change, at most 100; required, and an empty list means no tags.

  • tags_before_uuidsarray of stringsOptional

    The uuids of the tags the source carried when the change was prepared, at most 100; used to detect that its tags have changed since.

Returns

200 OK:

The effect the tag change would have on the source’s metrics.

Each failure is a problem document with a stable code; the response panel's status selector shows each one this operation can answer, and errors lists them all.

Revoke a metric source's token

POST/v1/metric-sources/{metric_source_uuid}/revoke-token

Revokes the source’s ingest token, so the source accepts no pushes until a new token is minted.

Needs the scope custom_metrics.delete.

Headers

  • Idempotency-KeystringOptional

    Any text of 1 to 255 visible ASCII characters. A repeat of the same request within 24 hours returns the first answer without running again (the response carries Idempotent-Replayed: true); the same key on a different request is refused 422 invalid_request.

Path parameters

  • metric_source_uuidstring (uuid)Required

    The uuid of the metric source in the path.

Returns

200 OK:

The metric source after its token was revoked.

Each failure is a problem document with a stable code; the response panel's status selector shows each one this operation can answer, and errors lists them all.

Rotate a metric source's token

POST/v1/metric-sources/{metric_source_uuid}/rotate-token

Mints a new ingest token for the source, replacing any earlier one. The token is returned once, in this answer; a replay under the same Idempotency-Key answers it as null, so a caller that lost it rotates again under a new key.

Needs the scope custom_metrics.edit.

Headers

  • Idempotency-KeystringOptional

    Any text of 1 to 255 visible ASCII characters. A repeat of the same request within 24 hours returns the first answer without running again (the response carries Idempotent-Replayed: true); the same key on a different request is refused 422 invalid_request.

Path parameters

  • metric_source_uuidstring (uuid)Required

    The uuid of the metric source in the path.

Returns

200 OK:

The new ingest token, shown once.

Each failure is a problem document with a stable code; the response panel's status selector shows each one this operation can answer, and errors lists them all.

Get the series of a metric source's metrics

GET/v1/metric-sources/{metric_source_uuid}/series

Returns the series of every custom metric of the source, ordered by name, then key, 25 metrics a page. Each item is the metric’s series as GET /v1/custom-metrics/{custom_metric_uuid}/series answers it; the window and the step are given once, in meta. The window, step, tz and aggregation work as they do there (tz puts the 1d and 1w points on the zone’s local midnights and Mondays, and meta gives the tz sent), but aggregation takes only avg, min, max or last, which apply to the source’s level metrics: a count metric always reads its sum, and its item says sum. A step that cuts the window into more than 720 points is refused for the whole call. A metric whose window holds more samples than the store reads in one query ends the page with 422 asking for a shorter window. A metric awaiting approval is listed with available: false and an empty series. Pages by page and per_page (limit is the same as per_page); every page carries current_page, per_page, last_page and total.

Needs the scope custom_metrics.view.

Path parameters

  • metric_source_uuidstring (uuid)Required

    The uuid of the metric source in the path.

Query parameters

  • periodstring or nullOptional

    A relative window ending now: 1 to 9999 minutes, hours, days or weeks (3h, 2w). Not with from and to. The operation names its longest window and its default.

  • fromstring or nullOptional

    The start of a pinned window, epoch milliseconds or RFC 3339 with an offset. Needs to. A start before the oldest data kept is served from it.

  • tostring or nullOptional

    The end of a pinned window, epoch milliseconds or RFC 3339 with an offset, after from. A window that ends before the oldest data kept, or in the future, is refused.

  • aggregationstring or nullOptional

    How each step of a level metric summarises its samples: avg, min, max or last. A count metric always reads its sum. Omitted, a level reads its value at each step.

    Values:avgminmaxlast(an open set: new values may be added)
  • stepstring or nullOptional

    The width of one step: 30s, 1m, 5m, 30m, 2h, 6h, 1d or 1w, refused when it cuts the window into more than 720 points. Omitted, the step follows the window’s length.

    Values:30s1m5m30m2h6h1d1w(an open set: new values may be added)
  • tzstring or nullOptional

    An IANA time zone name such as Europe/London. With a 1d or 1w step (sent, or chosen by the window’s length) each point sits at a local midnight of the zone, and a 1w point on a Monday’s; with any other step it changes nothing. Omitted, the steps are aligned to UTC as before.

  • limitinteger or nullOptional

    The same as per_page, kept for existing clients.

  • per_pageinteger or nullOptional

    The number of metrics in a page, from 1 to 25; 25 when omitted.

  • pageinteger or nullOptional

    The page to read, from 1; 1 when omitted. A page past the last answers no rows.

Returns

200 OK:

One page of the source’s metrics, each with its series.

Each item of the page:

  • availableboolean

    Whether the metric has data to chart: false while it awaits approval.

  • reasonstring or null

    awaiting_approval while available is false; null otherwise.

  • aggregationstring or null

    sum for a count metric; for a level metric the aggregation sent, or null when none was sent.

  • metricobject

    The metric the series belongs to.

  • seriesarray of objects

    One series for an approved metric, none while it awaits approval.

Each failure is a problem document with a stable code; the response panel's status selector shows each one this operation can answer, and errors lists them all.

Get the summaries of a metric source's metrics

GET/v1/metric-sources/{metric_source_uuid}/summary

Returns, for every custom metric of the source, the statistics GET /v1/custom-metrics/{custom_metric_uuid}/summary answers, over one window that defaults to the last day and reaches back as far as the metrics are kept (1,095 days; an earlier start is served from it), given once in meta with rolled_up, which says whether a window longer than 31 days was read from the daily summaries (p50 and p95 are then approximations, as in the single summary). Metrics are ordered by name, then key, 25 a page. A metric whose history is not summarised yet is listed with available: false and reason: rollup_pending. A window of 31 days or less that the store refuses because it holds more samples than one query reads answers 422 asking for a shorter window; data denser than the default 100,000 points a day can also end at the read budget with 503 store_unavailable. A shorter window, or a smaller per_page, then answers. A metric awaiting approval is listed with available: false and every statistic null. Pages by page and per_page (limit is the same as per_page); every page carries current_page, per_page, last_page and total.

Needs the scope custom_metrics.view.

Path parameters

  • metric_source_uuidstring (uuid)Required

    The uuid of the metric source in the path.

Query parameters

  • periodstring or nullOptional

    A relative window ending now: 1 to 9999 minutes, hours, days or weeks (3h, 2w). Not with from and to. The operation names its longest window and its default.

  • fromstring or nullOptional

    The start of a pinned window, epoch milliseconds or RFC 3339 with an offset. Needs to. A start before the oldest data kept is served from it.

  • tostring or nullOptional

    The end of a pinned window, epoch milliseconds or RFC 3339 with an offset, after from. A window that ends before the oldest data kept, or in the future, is refused.

  • limitinteger or nullOptional

    The same as per_page, kept for existing clients.

  • per_pageinteger or nullOptional

    The number of metrics in a page, from 1 to 25; 25 when omitted.

  • pageinteger or nullOptional

    The page to read, from 1; 1 when omitted. A page past the last answers no rows.

Returns

200 OK:

One page of the source’s metrics, each with its statistics.

Each item of the page:

  • availableboolean

    Whether the metric has samples to summarise: false while it awaits approval.

  • reasonstring or null

    awaiting_approval while the metric awaits approval, rollup_pending while a window longer than 31 days cannot be answered yet (the metric’s history is not summarised yet, or a day of the window is not recomputed yet); null while available is true.

  • metricobject

    The metric the statistics belong to.

  • sample_countinteger or null

    The number of samples in the window; null when it holds none.

  • sumnumber or null

    The sum of the samples’ values; null when the window holds none.

  • minnumber or null

    The smallest value; null when the window holds no sample.

  • maxnumber or null

    The largest value; null when the window holds no sample.

  • avgnumber or null

    The average value; null when the window holds no sample.

  • p50number or null

    The median value; null when the window holds no sample. Over 31 days (rolled_up) an approximation from a histogram of the values, within about 14% of the exact value, and null when the window holds a negative value.

  • p95number or null

    The 95th percentile of the values; null when the window holds no sample. Over 31 days (rolled_up) an approximation from a histogram of the values, within about 14% of the exact value, and null when the window holds a negative value.

  • first_atinteger or null

    Epoch milliseconds. When the window’s first sample was taken; null when it holds none.

    An instant: epoch milliseconds, UTC.
  • last_atinteger or null

    Epoch milliseconds. When the window’s last sample was taken; null when it holds none.

    An instant: epoch milliseconds, UTC.
  • lastnumber or null

    The window’s last value; null when it holds no sample.

Each failure is a problem document with a stable code; the response panel's status selector shows each one this operation can answer, and errors lists them all.