spans
Creates, updates, deletes, gets or lists a spans resource.
Overview
| Name | spans |
| Type | Resource |
| Id | datadog.metrics.spans |
Fields
The following fields are returned by SELECT queries:
- list_spans_get
| Name | Datatype | Description |
|---|---|---|
id | string | Unique ID of the Span. (example: AAAAAWgN8Xwgr1vKDQAAAABBV2dOOFh3ZzZobm1mWXJFYTR0OA) |
attributes | object | JSON object containing all span attributes and their associated values. |
type | string | Type of the span. (spans) (default: spans, example: spans) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
list_spans_get | select | filter[query], filter[from], filter[to], sort, page[cursor], page[limit] | List endpoint returns spans that match a span search query.<br />[Results are paginated][1].<br /><br />Use this endpoint to see your latest spans.<br />This endpoint is rate limited to 300 requests per hour.<br /><br />[1]: /logs/guide/collect-multiple-logs-with-pagination?tab=v2api | |
list_spans | insert | List endpoint returns spans that match a span search query.<br />[Results are paginated][1].<br /><br />Use this endpoint to build complex spans filtering and search.<br />This endpoint is rate limited to 300 requests per hour.<br /><br />[1]: /logs/guide/collect-multiple-logs-with-pagination?tab=v2api | ||
aggregate_spans | exec | The API endpoint to aggregate spans into buckets and compute metrics and timeseries.<br />This endpoint is rate limited to 300 requests per hour. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
site | string | The Datadog site (region) for your organization, for example datadoghq.com, us3.datadoghq.com, us5.datadoghq.com, ap1.datadoghq.com, ap2.datadoghq.com, datadoghq.eu, ddog-gov.com. Resolved from the DD_SITE environment variable when set. Optional: defaults to datadoghq.com, or the value of the DD_SITE environment variable when set; a WHERE value overrides both. |
filter[from] | string | Minimum timestamp for requested spans. Supports date-time ISO8601, date math, and regular timestamps (milliseconds). (example: 2023-01-02T09:42:36.320Z) |
filter[query] | string | Search query following spans syntax. (example: @datacenter:us @role:db) |
filter[to] | string | Maximum timestamp for requested spans. Supports date-time ISO8601, date math, and regular timestamps (milliseconds). (example: 2023-01-03T09:42:36.320Z) |
page[cursor] | string | List following results with a cursor provided in the previous query. (example: eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==) |
page[limit] | integer (int32) | Maximum number of spans in the response. (example: 25) |
sort | string | Order of spans in results. |
SELECT examples
- list_spans_get
List endpoint returns spans that match a span search query.<br />[Results are paginated][1].<br /><br />Use this endpoint to see your latest spans.<br />This endpoint is rate limited to 300 requests per hour.<br /><br />[1]: /logs/guide/collect-multiple-logs-with-pagination?tab=v2api
SELECT
id,
attributes,
type
FROM datadog.metrics.spans
WHERE filter[query] = '{{ filter[query] }}'
AND filter[from] = '{{ filter[from] }}'
AND filter[to] = '{{ filter[to] }}'
AND sort = '{{ sort }}'
AND page[cursor] = '{{ page[cursor] }}'
AND page[limit] = '{{ page[limit] }}'
;
INSERT examples
- list_spans
- Manifest
List endpoint returns spans that match a span search query.<br />[Results are paginated][1].<br /><br />Use this endpoint to build complex spans filtering and search.<br />This endpoint is rate limited to 300 requests per hour.<br /><br />[1]: /logs/guide/collect-multiple-logs-with-pagination?tab=v2api
INSERT INTO datadog.metrics.spans (
data
)
SELECT
'{{ data }}'
RETURNING
data,
links,
meta
;
# Description fields are for documentation purposes
- name: spans
props:
- name: data
description: |
The object containing the query content.
value:
attributes:
filter:
from: "{{ from }}"
query: "{{ query }}"
to: "{{ to }}"
options:
timeOffset: {{ timeOffset }}
timezone: "{{ timezone }}"
page:
cursor: "{{ cursor }}"
limit: {{ limit }}
sort: "{{ sort }}"
type: "{{ type }}"
Lifecycle Methods
EXEC variables use wire (API) names.
- aggregate_spans
The API endpoint to aggregate spans into buckets and compute metrics and timeseries.<br />This endpoint is rate limited to 300 requests per hour.
EXEC datadog.metrics.spans.aggregate_spans
@@json=
'{
"data": "{{ data }}"
}'
;