Skip to main content

spans

Creates, updates, deletes, gets or lists a spans resource.

Overview

Namespans
TypeResource
Iddatadog.metrics.spans

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringUnique ID of the Span. (example: AAAAAWgN8Xwgr1vKDQAAAABBV2dOOFh3ZzZobm1mWXJFYTR0OA)
attributesobjectJSON object containing all span attributes and their associated values.
typestringType of the span. (spans) (default: spans, example: spans)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
list_spans_getselectfilter[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_spansinsertList 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_spansexecThe 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.

NameDatatypeDescription
sitestringThe 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]stringMinimum timestamp for requested spans. Supports date-time ISO8601, date math, and regular timestamps (milliseconds). (example: 2023-01-02T09:42:36.320Z)
filter[query]stringSearch query following spans syntax. (example: @datacenter:us @role:db)
filter[to]stringMaximum timestamp for requested spans. Supports date-time ISO8601, date math, and regular timestamps (milliseconds). (example: 2023-01-03T09:42:36.320Z)
page[cursor]stringList 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)
sortstringOrder of spans in results.

SELECT examples

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 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
;

Lifecycle Methods

EXEC variables use wire (API) names.

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 }}"
}'
;