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

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_spans_metricselectmetric_idGet a specific span-based metric from your organization.
list_spans_metricsselectGet the list of configured span-based metrics with their definitions.
create_spans_metricinsertdataCreate a metric based on your ingested spans in your organization.<br />Returns the span-based metric object from the request body when the request is successful.
update_spans_metricupdatemetric_id, dataUpdate a specific span-based metric from your organization.<br />Returns the span-based metric object from the request body when the request is successful.
delete_spans_metricdeletemetric_idDelete 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.
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.

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
;

INSERT examples

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

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

UPDATE examples

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

UPDATE datadog.apm.spans_metrics
SET
data = '{{ data }}'
WHERE
metric_id = '{{ metric_id }}' --required
AND 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
;