List extracted metrics

List a source's extracted metrics, the rules that turn logs into metrics.

GET https://telemetry.betterstack.com/api/v4/sources/{source_id}/extracted-metrics
source_id string required

Source whose extracted metrics are listed.

page integer

Page to return, starting at 1.

per_page integer default: 50

Results per page. Maximum 250.

team_id string

Team to use, such as t123. Get the ID via List teams. Required when you can access more than one team.

Authorization string required

Bearer $TOKEN

Results are paginated

Use pagination.next and pagination.prev to move through pages or jump to a specific one using page and per_page. See Pagination.

200 OK
{
  "data": [
    {
      "id": "m-123",
      "type": "metric",
      "attributes": {
        "id": "m-123",
        "name": "level",
        "sql_expression": "JSONExtract(raw, 'level', 'Nullable(String)')",
        "type": "string_low_cardinality",
        "aggregations": [
          "avg",
          "histogram",
          "min",
          "max"
        ],
        "team_id": "t123"
      }
    }
  ],
  "pagination": {
    "first": "https://telemetry.betterstack.com/api/v4/sources/123/extracted-metrics?page=1",
    "last": "https://telemetry.betterstack.com/api/v4/sources/123/extracted-metrics?page=1",
    "prev": null,
    "next": null,
    "total_count": 1
  }
}

Returns the list of extracted metrics.

id string

The ID of the extracted metric, such as m-123.

type string

Always metric.

attributes.id string

The ID of the extracted metric, starting with m- for a metric and g- for a label, such as m-123.

name string

Metric or label name.

sql_expression string

SQL expression evaluated for each log. Log fields are in the raw JSON field, so read them with JSONExtract(raw, ..., 'Nullable(Type)').

attributes.type string

ClickHouse type the value is stored as. Possible values: string, string_low_cardinality, int64_delta, int64, uint64_delta, uint64, float64_delta, datetime64_delta, boolean.

aggregations array of strings

Aggregations to precompute, avg, count, uniq, max, min, sum or histogram. An empty array makes this a label rather than a metric.

team_id string

Team that owns the metric's source, such as t123.

pagination.first string

The URL of the first page of results.

pagination.last string

The URL of the last page of results.

pagination.prev string or null

The URL of the previous page, or null on the first page.

pagination.next string or null

The URL of the next page, or null on the last page.

pagination.total_count integer

How many results the whole list holds, across every page.

Example cURL

List extracted metrics
curl --request GET \
  --url https://telemetry.betterstack.com/api/v4/sources/123/extracted-metrics \
  --header "Authorization: Bearer $TOKEN"