1. Packages
  2. Datadog Provider
  3. API Docs
  4. SpansMetric
Datadog v4.48.1 published on Saturday, Apr 5, 2025 by Pulumi

datadog.SpansMetric

Explore with Pulumi AI

Provides a Datadog SpansMetric resource. This can be used to create and manage Datadog spans_metric.

Example Usage

Coming soon!
Coming soon!
Coming soon!
Coming soon!
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.datadog.SpansMetric;
import com.pulumi.datadog.SpansMetricArgs;
import com.pulumi.datadog.inputs.SpansMetricGroupByArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        // Create new spans_metric resource
        var testingSpansMetric = new SpansMetric("testingSpansMetric", SpansMetricArgs.builder()
            .name("testing.span.metric")
            .compute(SpansMetricComputeArgs.builder()
                .aggregationType("distribution")
                .includePercentiles(false)
                .path("@duration")
                .build())
            .filter(SpansMetricFilterArgs.builder()
                .query("@http.status_code:200 service:my-service")
                .build())
            .groupBies(SpansMetricGroupByArgs.builder()
                .path("resource_name")
                .tagName("resource_name")
                .build())
            .build());

    }
}
Copy
resources:
  # Create new spans_metric resource
  testingSpansMetric:
    type: datadog:SpansMetric
    name: testing_spans_metric
    properties:
      name: testing.span.metric
      compute:
        - aggregationType: distribution
          includePercentiles: false
          path: '@duration'
      filter:
        - query: '@http.status_code:200 service:my-service'
      groupBies:
        - path: resource_name
          tagName: resource_name
Copy

Create SpansMetric Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new SpansMetric(name: string, args: SpansMetricArgs, opts?: CustomResourceOptions);
@overload
def SpansMetric(resource_name: str,
                args: SpansMetricArgs,
                opts: Optional[ResourceOptions] = None)

@overload
def SpansMetric(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                name: Optional[str] = None,
                compute: Optional[SpansMetricComputeArgs] = None,
                filter: Optional[SpansMetricFilterArgs] = None,
                group_bies: Optional[Sequence[SpansMetricGroupByArgs]] = None)
func NewSpansMetric(ctx *Context, name string, args SpansMetricArgs, opts ...ResourceOption) (*SpansMetric, error)
public SpansMetric(string name, SpansMetricArgs args, CustomResourceOptions? opts = null)
public SpansMetric(String name, SpansMetricArgs args)
public SpansMetric(String name, SpansMetricArgs args, CustomResourceOptions options)
type: datadog:SpansMetric
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. SpansMetricArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. SpansMetricArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. SpansMetricArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. SpansMetricArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. SpansMetricArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var spansMetricResource = new Datadog.SpansMetric("spansMetricResource", new()
{
    Name = "string",
    Compute = new Datadog.Inputs.SpansMetricComputeArgs
    {
        AggregationType = "string",
        IncludePercentiles = false,
        Path = "string",
    },
    Filter = new Datadog.Inputs.SpansMetricFilterArgs
    {
        Query = "string",
    },
    GroupBies = new[]
    {
        new Datadog.Inputs.SpansMetricGroupByArgs
        {
            Path = "string",
            TagName = "string",
        },
    },
});
Copy
example, err := datadog.NewSpansMetric(ctx, "spansMetricResource", &datadog.SpansMetricArgs{
	Name: pulumi.String("string"),
	Compute: &datadog.SpansMetricComputeArgs{
		AggregationType:    pulumi.String("string"),
		IncludePercentiles: pulumi.Bool(false),
		Path:               pulumi.String("string"),
	},
	Filter: &datadog.SpansMetricFilterArgs{
		Query: pulumi.String("string"),
	},
	GroupBies: datadog.SpansMetricGroupByArray{
		&datadog.SpansMetricGroupByArgs{
			Path:    pulumi.String("string"),
			TagName: pulumi.String("string"),
		},
	},
})
Copy
var spansMetricResource = new SpansMetric("spansMetricResource", SpansMetricArgs.builder()
    .name("string")
    .compute(SpansMetricComputeArgs.builder()
        .aggregationType("string")
        .includePercentiles(false)
        .path("string")
        .build())
    .filter(SpansMetricFilterArgs.builder()
        .query("string")
        .build())
    .groupBies(SpansMetricGroupByArgs.builder()
        .path("string")
        .tagName("string")
        .build())
    .build());
Copy
spans_metric_resource = datadog.SpansMetric("spansMetricResource",
    name="string",
    compute={
        "aggregation_type": "string",
        "include_percentiles": False,
        "path": "string",
    },
    filter={
        "query": "string",
    },
    group_bies=[{
        "path": "string",
        "tag_name": "string",
    }])
Copy
const spansMetricResource = new datadog.SpansMetric("spansMetricResource", {
    name: "string",
    compute: {
        aggregationType: "string",
        includePercentiles: false,
        path: "string",
    },
    filter: {
        query: "string",
    },
    groupBies: [{
        path: "string",
        tagName: "string",
    }],
});
Copy
type: datadog:SpansMetric
properties:
    compute:
        aggregationType: string
        includePercentiles: false
        path: string
    filter:
        query: string
    groupBies:
        - path: string
          tagName: string
    name: string
Copy

SpansMetric Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The SpansMetric resource accepts the following input properties:

Name This property is required. string
The name of the span-based metric. This field can't be updated after creation.
Compute SpansMetricCompute
Filter SpansMetricFilter
GroupBies List<SpansMetricGroupBy>
Name This property is required. string
The name of the span-based metric. This field can't be updated after creation.
Compute SpansMetricComputeArgs
Filter SpansMetricFilterArgs
GroupBies []SpansMetricGroupByArgs
name This property is required. String
The name of the span-based metric. This field can't be updated after creation.
compute SpansMetricCompute
filter SpansMetricFilter
groupBies List<SpansMetricGroupBy>
name This property is required. string
The name of the span-based metric. This field can't be updated after creation.
compute SpansMetricCompute
filter SpansMetricFilter
groupBies SpansMetricGroupBy[]
name This property is required. str
The name of the span-based metric. This field can't be updated after creation.
compute SpansMetricComputeArgs
filter SpansMetricFilterArgs
group_bies Sequence[SpansMetricGroupByArgs]
name This property is required. String
The name of the span-based metric. This field can't be updated after creation.
compute Property Map
filter Property Map
groupBies List<Property Map>

Outputs

All input properties are implicitly available as output properties. Additionally, the SpansMetric resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing SpansMetric Resource

Get an existing SpansMetric resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: SpansMetricState, opts?: CustomResourceOptions): SpansMetric
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        compute: Optional[SpansMetricComputeArgs] = None,
        filter: Optional[SpansMetricFilterArgs] = None,
        group_bies: Optional[Sequence[SpansMetricGroupByArgs]] = None,
        name: Optional[str] = None) -> SpansMetric
func GetSpansMetric(ctx *Context, name string, id IDInput, state *SpansMetricState, opts ...ResourceOption) (*SpansMetric, error)
public static SpansMetric Get(string name, Input<string> id, SpansMetricState? state, CustomResourceOptions? opts = null)
public static SpansMetric get(String name, Output<String> id, SpansMetricState state, CustomResourceOptions options)
resources:  _:    type: datadog:SpansMetric    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Compute SpansMetricCompute
Filter SpansMetricFilter
GroupBies List<SpansMetricGroupBy>
Name string
The name of the span-based metric. This field can't be updated after creation.
Compute SpansMetricComputeArgs
Filter SpansMetricFilterArgs
GroupBies []SpansMetricGroupByArgs
Name string
The name of the span-based metric. This field can't be updated after creation.
compute SpansMetricCompute
filter SpansMetricFilter
groupBies List<SpansMetricGroupBy>
name String
The name of the span-based metric. This field can't be updated after creation.
compute SpansMetricCompute
filter SpansMetricFilter
groupBies SpansMetricGroupBy[]
name string
The name of the span-based metric. This field can't be updated after creation.
compute SpansMetricComputeArgs
filter SpansMetricFilterArgs
group_bies Sequence[SpansMetricGroupByArgs]
name str
The name of the span-based metric. This field can't be updated after creation.
compute Property Map
filter Property Map
groupBies List<Property Map>
name String
The name of the span-based metric. This field can't be updated after creation.

Supporting Types

SpansMetricCompute
, SpansMetricComputeArgs

AggregationType This property is required. string
The type of aggregation to use. This field can't be updated after creation.
IncludePercentiles bool
Toggle to include or exclude percentile aggregations for distribution metrics. Only present when the aggregation_type is distribution.
Path string
The path to the value the span-based metric will aggregate on (only used if the aggregation type is a "distribution"). This field can't be updated after creation.
AggregationType This property is required. string
The type of aggregation to use. This field can't be updated after creation.
IncludePercentiles bool
Toggle to include or exclude percentile aggregations for distribution metrics. Only present when the aggregation_type is distribution.
Path string
The path to the value the span-based metric will aggregate on (only used if the aggregation type is a "distribution"). This field can't be updated after creation.
aggregationType This property is required. String
The type of aggregation to use. This field can't be updated after creation.
includePercentiles Boolean
Toggle to include or exclude percentile aggregations for distribution metrics. Only present when the aggregation_type is distribution.
path String
The path to the value the span-based metric will aggregate on (only used if the aggregation type is a "distribution"). This field can't be updated after creation.
aggregationType This property is required. string
The type of aggregation to use. This field can't be updated after creation.
includePercentiles boolean
Toggle to include or exclude percentile aggregations for distribution metrics. Only present when the aggregation_type is distribution.
path string
The path to the value the span-based metric will aggregate on (only used if the aggregation type is a "distribution"). This field can't be updated after creation.
aggregation_type This property is required. str
The type of aggregation to use. This field can't be updated after creation.
include_percentiles bool
Toggle to include or exclude percentile aggregations for distribution metrics. Only present when the aggregation_type is distribution.
path str
The path to the value the span-based metric will aggregate on (only used if the aggregation type is a "distribution"). This field can't be updated after creation.
aggregationType This property is required. String
The type of aggregation to use. This field can't be updated after creation.
includePercentiles Boolean
Toggle to include or exclude percentile aggregations for distribution metrics. Only present when the aggregation_type is distribution.
path String
The path to the value the span-based metric will aggregate on (only used if the aggregation type is a "distribution"). This field can't be updated after creation.

SpansMetricFilter
, SpansMetricFilterArgs

Query string
The search query - following the span search syntax. Defaults to "*".
Query string
The search query - following the span search syntax. Defaults to "*".
query String
The search query - following the span search syntax. Defaults to "*".
query string
The search query - following the span search syntax. Defaults to "*".
query str
The search query - following the span search syntax. Defaults to "*".
query String
The search query - following the span search syntax. Defaults to "*".

SpansMetricGroupBy
, SpansMetricGroupByArgs

Path This property is required. string
The path to the value the span-based metric will be aggregated over.
TagName string
Eventual name of the tag that gets created. By default, the path attribute is used as the tag name.
Path This property is required. string
The path to the value the span-based metric will be aggregated over.
TagName string
Eventual name of the tag that gets created. By default, the path attribute is used as the tag name.
path This property is required. String
The path to the value the span-based metric will be aggregated over.
tagName String
Eventual name of the tag that gets created. By default, the path attribute is used as the tag name.
path This property is required. string
The path to the value the span-based metric will be aggregated over.
tagName string
Eventual name of the tag that gets created. By default, the path attribute is used as the tag name.
path This property is required. str
The path to the value the span-based metric will be aggregated over.
tag_name str
Eventual name of the tag that gets created. By default, the path attribute is used as the tag name.
path This property is required. String
The path to the value the span-based metric will be aggregated over.
tagName String
Eventual name of the tag that gets created. By default, the path attribute is used as the tag name.

Import

$ pulumi import datadog:index/spansMetric:SpansMetric testing_spans_metric testing.span.metric
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
Datadog pulumi/pulumi-datadog
License
Apache-2.0
Notes
This Pulumi package is based on the datadog Terraform Provider.