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. (default: spans, example: spans)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
list_spans_getselectregionfilter[query], filter[from], filter[to], sort, page[cursor], page[limit]List endpoint returns spans that match a span search query.
[Results are paginated][1].

Use this endpoint to see your latest spans.
This endpoint is rate limited to 300 requests per hour.

[1]: /logs/guide/collect-multiple-logs-with-pagination?tab=v2api
list_spansinsertregionList endpoint returns spans that match a span search query.
[Results are paginated][1].

Use this endpoint to build complex spans filtering and search.
This endpoint is rate limited to 300 requests per hour.

[1]: /logs/guide/collect-multiple-logs-with-pagination?tab=v2api
aggregate_spansexecregionThe API endpoint to aggregate spans into buckets and compute metrics and timeseries.
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
regionstring(default: datadoghq.com)
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.
[Results are paginated][1].

Use this endpoint to see your latest spans.
This endpoint is rate limited to 300 requests per hour.

[1]: /logs/guide/collect-multiple-logs-with-pagination?tab=v2api

SELECT
id,
attributes,
type
FROM datadog.metrics.spans
WHERE region = '{{ region }}' -- required
AND 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.
[Results are paginated][1].

Use this endpoint to build complex spans filtering and search.
This endpoint is rate limited to 300 requests per hour.

[1]: /logs/guide/collect-multiple-logs-with-pagination?tab=v2api

INSERT INTO datadog.metrics.spans (
data__data,
region
)
SELECT
'{{ data }}',
'{{ region }}'
RETURNING
data,
links,
meta
;

Lifecycle Methods

The API endpoint to aggregate spans into buckets and compute metrics and timeseries.
This endpoint is rate limited to 300 requests per hour.

EXEC datadog.metrics.spans.aggregate_spans 
@region='{{ region }}' --required
@@json=
'{
"data": "{{ data }}"
}'
;