Skip to main content

spans_metrics

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

Overview

Namespans_metrics
TypeResource
Iddatadog.apm.spans_metrics

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringThe name of the span-based metric. (example: my.metric)
attributesobjectThe object describing a Datadog span-based metric.
typestringThe type of resource. The value should always be spans_metrics. (default: spans_metrics, example: spans_metrics)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_spans_metricselectmetric_id, regionGet a specific span-based metric from your organization.
list_spans_metricsselectregionGet the list of configured span-based metrics with their definitions.
create_spans_metricinsertregion, data__dataCreate a metric based on your ingested spans in your organization.
Returns the span-based metric object from the request body when the request is successful.
update_spans_metricupdatemetric_id, region, data__dataUpdate a specific span-based metric from your organization.
Returns the span-based metric object from the request body when the request is successful.
delete_spans_metricdeletemetric_id, regionDelete a specific span-based metric from your organization.

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
metric_idstringThe name of the span-based metric.
regionstring(default: datadoghq.com)

SELECT examples

Get a specific span-based metric from your organization.

SELECT
id,
attributes,
type
FROM datadog.apm.spans_metrics
WHERE metric_id = '{{ metric_id }}' -- required
AND region = '{{ region }}' -- required
;

INSERT examples

Create a metric based on your ingested spans in your organization.
Returns the span-based metric object from the request body when the request is successful.

INSERT INTO datadog.apm.spans_metrics (
data__data,
region
)
SELECT
'{{ data }}' /* required */,
'{{ region }}'
RETURNING
data
;

UPDATE examples

Update a specific span-based metric from your organization.
Returns the span-based metric object from the request body when the request is successful.

UPDATE datadog.apm.spans_metrics
SET
data__data = '{{ data }}'
WHERE
metric_id = '{{ metric_id }}' --required
AND region = '{{ region }}' --required
AND data__data = '{{ data }}' --required
RETURNING
data;

DELETE examples

Delete a specific span-based metric from your organization.

DELETE FROM datadog.apm.spans_metrics
WHERE metric_id = '{{ metric_id }}' --required
AND region = '{{ region }}' --required
;