List an Organization's Trace Metrics

ExperimentalThis API is under active development and may change.
GET /api/0/organizations/{organization_id_or_slug}/trace-items/metrics/

List trace metrics (name, type, unit, count, last seen) with optional context.

Path Parameters

organization_id_or_slug (string)
REQUIRED

The ID or slug of the organization the resource belongs to.

Query Parameters:

project (array(undefined))

The IDs or slugs of projects to filter by. Project slugs are unique within each organization. Omit this parameter to include all accessible projects. -1 is also accepted to include all accessible projects. For example, the following are valid parameters:

  • /?project=1234&project=56789
  • /?project=android&project=javascript-react
  • /?project=-1
environment (array(string))

The name of environments to filter by.

statsPeriod (string)

The period of time for the query, will override the start & end parameters, a number followed by one of:

  • d for days
  • h for hours
  • m for minutes
  • s for seconds
  • w for weeks

For example, 24h, to mean query data starting from 24 hours ago to now.

start (string)

The start of the period of time for the query, expected in ISO-8601 format. For example, 2001-12-14T12:34:56.7890.

end (string)

The end of the period of time for the query, expected in ISO-8601 format. For example, 2001-12-14T12:34:56.7890.

query (string)

Search query to filter metrics, using the same syntax as the metrics dataset.

sort (string)
choices:
  • -count
  • -lastSeen
  • -name
  • -type
  • -unit
  • count
  • lastSeen
  • name
  • type
  • unit

Response field to sort by, prefixed with - for descending. Defaults to metric name ascending.

expand (array(string))
choices:
  • context

Optional fields to expand. Pass context to include each metric's authored context (brief and details), which describes what the metric measures. Requires the data-browsing-attribute-context feature; without it the context field is omitted.

contextOnly (boolean)

Return only metrics that have authored context, and include that context in the response. Use this to discover the metrics that are described well enough to query confidently. Requires the data-browsing-attribute-context feature; without it this is a no-op.

Scopes

<auth_token> requires one of the following scopes:
  • org:admin
  • org:read
  • org:write
Copied
curl https://sentry.io/api/0/organizations/{organization_id_or_slug}/trace-items/metrics/ \
 -H 'Authorization: Bearer <auth_token>'
RESPONSESCHEMA
Copied
[ { "name": "checkout.latency", "type": "distribution", "unit": "millisecond", "count": 1432, "lastSeen": 1735689600, "context": { "brief": "End-to-end latency of the checkout flow.", "details": [ "Recorded once per completed checkout, from cart submit to receipt." ] } }, { "name": "cart.items", "type": "gauge", "unit": null, "count": 87, "lastSeen": 1735686000 } ]
Was this helpful?