spans_metrics
Creates, updates, deletes, gets or lists a spans_metrics resource.
Overview
| Name | spans_metrics | 
| Type | Resource | 
| Id | datadog.apm.spans_metrics | 
Fields
The following fields are returned by SELECT queries:
- get_spans_metric
- list_spans_metrics
| Name | Datatype | Description | 
|---|---|---|
| id | string | The name of the span-based metric. (example: my.metric) | 
| attributes | object | The object describing a Datadog span-based metric. | 
| type | string | The type of resource. The value should always be spans_metrics. (default: spans_metrics, example: spans_metrics) | 
| Name | Datatype | Description | 
|---|---|---|
| id | string | The name of the span-based metric. (example: my.metric) | 
| attributes | object | The object describing a Datadog span-based metric. | 
| type | string | The 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:
| Name | Accessible by | Required Params | Optional Params | Description | 
|---|---|---|---|---|
| get_spans_metric | select | metric_id,region | Get a specific span-based metric from your organization. | |
| list_spans_metrics | select | region | Get the list of configured span-based metrics with their definitions. | |
| create_spans_metric | insert | region,data__data | 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. | |
| update_spans_metric | update | metric_id,region,data__data | Update 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_metric | delete | metric_id,region | Delete 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.
| Name | Datatype | Description | 
|---|---|---|
| metric_id | string | The name of the span-based metric. | 
| region | string | (default: datadoghq.com) | 
SELECT examples
- get_spans_metric
- list_spans_metrics
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
;
Get the list of configured span-based metrics with their definitions.
SELECT
id,
attributes,
type
FROM datadog.apm.spans_metrics
WHERE region = '{{ region }}' -- required
;
INSERT examples
- create_spans_metric
- Manifest
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
;
# Description fields are for documentation purposes
- name: spans_metrics
  props:
    - name: region
      value: string
      description: Required parameter for the spans_metrics resource.
    - name: data
      value: object
      description: |
        The new span-based metric properties.
UPDATE examples
- update_spans_metric
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_spans_metric
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
;