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. (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 | region | filter[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 300requests per hour.[1]: /logs/guide/collect-multiple-logs-with-pagination?tab=v2api | 
| list_spans | insert | region | 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 300requests per hour.[1]: /logs/guide/collect-multiple-logs-with-pagination?tab=v2api | |
| aggregate_spans | exec | region | The API endpoint to aggregate spans into buckets and compute metrics and timeseries. This endpoint is rate limited to 300requests 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 | 
|---|---|---|
| region | string | (default: datadoghq.com) | 
| 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.
[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_spans
- Manifest
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
;
# Description fields are for documentation purposes
- name: spans
  props:
    - name: region
      value: string
      description: Required parameter for the spans resource.
    - name: data
      value: object
      description: |
        The object containing the query content.
Lifecycle Methods
- aggregate_spans
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 }}"
}'
;