Retrieve Trace Item Statistics

GET /api/0/organizations/{organization_id_or_slug}/trace-items/stats/

Compute statistics, such as attribute value distributions, over the trace items (spans or occurrences) matching the given query within the requested time range.

Path Parameters

organization_id_or_slug (string)
REQUIRED

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

Query Parameters:

statsType (array(string))
REQUIRED
choices:
  • attributeDistributions

The statistics to compute over the matching trace items.

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.

itemType (string)
choices:
  • occurrences
  • spans

The trace item dataset to compute statistics for. Defaults to spans.

query (string)

Sentry search syntax to filter trace items before computing statistics.

substringMatch (string)

Restrict results to attribute names containing this substring (case-sensitive).

traceItemsLimit (integer)

Maximum number of trace items to sample when computing statistics. Defaults to 1000, which is also the maximum.

cursor (string)

A pointer to the last object fetched and its sort order; used to retrieve the next or previous results.

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/stats/ \
 -H 'Authorization: Bearer <auth_token>'
RESPONSESCHEMA
Copied
{ "data": [ { "attributeDistributions": { "data": { "sentry.device": [ { "label": "mobile", "value": 3 }, { "label": "desktop", "value": 1 } ], "browser.name": [ { "label": "chrome", "value": 3 }, { "label": "safari", "value": 1 } ] } } } ] }
Was this helpful?