launchdarkly logo
Launch Darkly v0.0.5, Dec 17 22

launchdarkly.Metric

Provides a LaunchDarkly metric resource.

This resource allows you to create and manage metrics within your LaunchDarkly organization.

To learn more about metrics and experimentation, read Experimentation Documentation.

Example Usage

using System.Collections.Generic;
using Pulumi;
using Launchdarkly = Lbrlabs.PulumiPackage.Launchdarkly;

return await Deployment.RunAsync(() => 
{
    var example = new Launchdarkly.Metric("example", new()
    {
        ProjectKey = launchdarkly_project.Example.Key,
        Key = "example-metric",
        Description = "Metric description.",
        Kind = "pageview",
        Tags = new[]
        {
            "example",
        },
        Urls = new[]
        {
            new Launchdarkly.Inputs.MetricUrlArgs
            {
                Kind = "substring",
                Substring = "foo",
            },
        },
    });

});
package main

import (
	"github.com/lbrlabs/pulumi-launchdarkly/sdk/go/launchdarkly"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := launchdarkly.NewMetric(ctx, "example", &launchdarkly.MetricArgs{
			ProjectKey:  pulumi.Any(launchdarkly_project.Example.Key),
			Key:         pulumi.String("example-metric"),
			Description: pulumi.String("Metric description."),
			Kind:        pulumi.String("pageview"),
			Tags: pulumi.StringArray{
				pulumi.String("example"),
			},
			Urls: launchdarkly.MetricUrlArray{
				&launchdarkly.MetricUrlArgs{
					Kind:      pulumi.String("substring"),
					Substring: pulumi.String("foo"),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.launchdarkly.Metric;
import com.pulumi.launchdarkly.MetricArgs;
import com.pulumi.launchdarkly.inputs.MetricUrlArgs;
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) {
        var example = new Metric("example", MetricArgs.builder()        
            .projectKey(launchdarkly_project.example().key())
            .key("example-metric")
            .description("Metric description.")
            .kind("pageview")
            .tags("example")
            .urls(MetricUrlArgs.builder()
                .kind("substring")
                .substring("foo")
                .build())
            .build());

    }
}
import pulumi
import lbrlabs_pulumi_launchdarkly as launchdarkly

example = launchdarkly.Metric("example",
    project_key=launchdarkly_project["example"]["key"],
    key="example-metric",
    description="Metric description.",
    kind="pageview",
    tags=["example"],
    urls=[launchdarkly.MetricUrlArgs(
        kind="substring",
        substring="foo",
    )])
import * as pulumi from "@pulumi/pulumi";
import * as launchdarkly from "@lbrlabs/pulumi-launchdarkly";

const example = new launchdarkly.Metric("example", {
    projectKey: launchdarkly_project.example.key,
    key: "example-metric",
    description: "Metric description.",
    kind: "pageview",
    tags: ["example"],
    urls: [{
        kind: "substring",
        substring: "foo",
    }],
});
resources:
  example:
    type: launchdarkly:Metric
    properties:
      projectKey: ${launchdarkly_project.example.key}
      key: example-metric
      description: Metric description.
      kind: pageview
      tags:
        - example
      urls:
        - kind: substring
          substring: foo

Create Metric Resource

new Metric(name: string, args: MetricArgs, opts?: CustomResourceOptions);
@overload
def Metric(resource_name: str,
           opts: Optional[ResourceOptions] = None,
           description: Optional[str] = None,
           event_key: Optional[str] = None,
           is_active: Optional[bool] = None,
           is_numeric: Optional[bool] = None,
           key: Optional[str] = None,
           kind: Optional[str] = None,
           maintainer_id: Optional[str] = None,
           name: Optional[str] = None,
           project_key: Optional[str] = None,
           selector: Optional[str] = None,
           success_criteria: Optional[str] = None,
           tags: Optional[Sequence[str]] = None,
           unit: Optional[str] = None,
           urls: Optional[Sequence[MetricUrlArgs]] = None)
@overload
def Metric(resource_name: str,
           args: MetricArgs,
           opts: Optional[ResourceOptions] = None)
func NewMetric(ctx *Context, name string, args MetricArgs, opts ...ResourceOption) (*Metric, error)
public Metric(string name, MetricArgs args, CustomResourceOptions? opts = null)
public Metric(String name, MetricArgs args)
public Metric(String name, MetricArgs args, CustomResourceOptions options)
type: launchdarkly:Metric
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

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

Metric Resource Properties

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

Inputs

The Metric resource accepts the following input properties:

Key string

The unique key that references the metric. A change in this field will force the destruction of the existing resource and the creation of a new one.

Kind string

The metric type. Available choices are click, custom, and pageview. A change in this field will force the destruction of the existing resource and the creation of a new one.

ProjectKey string

The metrics's project key. A change in this field will force the destruction of the existing resource and the creation of a new one.

Description string

The description of the metric's purpose.

EventKey string

The event key to watch for custom metrics.

IsActive bool

Whether the metric is active

IsNumeric bool

Whether the metric is numeric

MaintainerId string

The LaunchDarkly ID of the user who will maintain the metric. If not set, the API will automatically apply the member associated with your Terraform API key or the most recently-set maintainer

Name string

The human-friendly name for the metric.

Selector string

The CSS selector for click metrics.

SuccessCriteria string

The success criteria for numeric custom metrics.

Tags List<string>

Set of tags for the metric.

Unit string

The unit for numeric custom metrics.

Urls List<Lbrlabs.PulumiPackage.Launchdarkly.Inputs.MetricUrlArgs>

A block determining which URLs the metric watches. To learn more, read Nested Urls Blocks.

Key string

The unique key that references the metric. A change in this field will force the destruction of the existing resource and the creation of a new one.

Kind string

The metric type. Available choices are click, custom, and pageview. A change in this field will force the destruction of the existing resource and the creation of a new one.

ProjectKey string

The metrics's project key. A change in this field will force the destruction of the existing resource and the creation of a new one.

Description string

The description of the metric's purpose.

EventKey string

The event key to watch for custom metrics.

IsActive bool

Whether the metric is active

IsNumeric bool

Whether the metric is numeric

MaintainerId string

The LaunchDarkly ID of the user who will maintain the metric. If not set, the API will automatically apply the member associated with your Terraform API key or the most recently-set maintainer

Name string

The human-friendly name for the metric.

Selector string

The CSS selector for click metrics.

SuccessCriteria string

The success criteria for numeric custom metrics.

Tags []string

Set of tags for the metric.

Unit string

The unit for numeric custom metrics.

Urls []MetricUrlArgs

A block determining which URLs the metric watches. To learn more, read Nested Urls Blocks.

key String

The unique key that references the metric. A change in this field will force the destruction of the existing resource and the creation of a new one.

kind String

The metric type. Available choices are click, custom, and pageview. A change in this field will force the destruction of the existing resource and the creation of a new one.

projectKey String

The metrics's project key. A change in this field will force the destruction of the existing resource and the creation of a new one.

description String

The description of the metric's purpose.

eventKey String

The event key to watch for custom metrics.

isActive Boolean

Whether the metric is active

isNumeric Boolean

Whether the metric is numeric

maintainerId String

The LaunchDarkly ID of the user who will maintain the metric. If not set, the API will automatically apply the member associated with your Terraform API key or the most recently-set maintainer

name String

The human-friendly name for the metric.

selector String

The CSS selector for click metrics.

successCriteria String

The success criteria for numeric custom metrics.

tags List<String>

Set of tags for the metric.

unit String

The unit for numeric custom metrics.

urls List<MetricUrlArgs>

A block determining which URLs the metric watches. To learn more, read Nested Urls Blocks.

key string

The unique key that references the metric. A change in this field will force the destruction of the existing resource and the creation of a new one.

kind string

The metric type. Available choices are click, custom, and pageview. A change in this field will force the destruction of the existing resource and the creation of a new one.

projectKey string

The metrics's project key. A change in this field will force the destruction of the existing resource and the creation of a new one.

description string

The description of the metric's purpose.

eventKey string

The event key to watch for custom metrics.

isActive boolean

Whether the metric is active

isNumeric boolean

Whether the metric is numeric

maintainerId string

The LaunchDarkly ID of the user who will maintain the metric. If not set, the API will automatically apply the member associated with your Terraform API key or the most recently-set maintainer

name string

The human-friendly name for the metric.

selector string

The CSS selector for click metrics.

successCriteria string

The success criteria for numeric custom metrics.

tags string[]

Set of tags for the metric.

unit string

The unit for numeric custom metrics.

urls MetricUrlArgs[]

A block determining which URLs the metric watches. To learn more, read Nested Urls Blocks.

key str

The unique key that references the metric. A change in this field will force the destruction of the existing resource and the creation of a new one.

kind str

The metric type. Available choices are click, custom, and pageview. A change in this field will force the destruction of the existing resource and the creation of a new one.

project_key str

The metrics's project key. A change in this field will force the destruction of the existing resource and the creation of a new one.

description str

The description of the metric's purpose.

event_key str

The event key to watch for custom metrics.

is_active bool

Whether the metric is active

is_numeric bool

Whether the metric is numeric

maintainer_id str

The LaunchDarkly ID of the user who will maintain the metric. If not set, the API will automatically apply the member associated with your Terraform API key or the most recently-set maintainer

name str

The human-friendly name for the metric.

selector str

The CSS selector for click metrics.

success_criteria str

The success criteria for numeric custom metrics.

tags Sequence[str]

Set of tags for the metric.

unit str

The unit for numeric custom metrics.

urls Sequence[MetricUrlArgs]

A block determining which URLs the metric watches. To learn more, read Nested Urls Blocks.

key String

The unique key that references the metric. A change in this field will force the destruction of the existing resource and the creation of a new one.

kind String

The metric type. Available choices are click, custom, and pageview. A change in this field will force the destruction of the existing resource and the creation of a new one.

projectKey String

The metrics's project key. A change in this field will force the destruction of the existing resource and the creation of a new one.

description String

The description of the metric's purpose.

eventKey String

The event key to watch for custom metrics.

isActive Boolean

Whether the metric is active

isNumeric Boolean

Whether the metric is numeric

maintainerId String

The LaunchDarkly ID of the user who will maintain the metric. If not set, the API will automatically apply the member associated with your Terraform API key or the most recently-set maintainer

name String

The human-friendly name for the metric.

selector String

The CSS selector for click metrics.

successCriteria String

The success criteria for numeric custom metrics.

tags List<String>

Set of tags for the metric.

unit String

The unit for numeric custom metrics.

urls List<Property Map>

A block determining which URLs the metric watches. To learn more, read Nested Urls Blocks.

Outputs

All input properties are implicitly available as output properties. Additionally, the Metric 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 Metric Resource

Get an existing Metric 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?: MetricState, opts?: CustomResourceOptions): Metric
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        description: Optional[str] = None,
        event_key: Optional[str] = None,
        is_active: Optional[bool] = None,
        is_numeric: Optional[bool] = None,
        key: Optional[str] = None,
        kind: Optional[str] = None,
        maintainer_id: Optional[str] = None,
        name: Optional[str] = None,
        project_key: Optional[str] = None,
        selector: Optional[str] = None,
        success_criteria: Optional[str] = None,
        tags: Optional[Sequence[str]] = None,
        unit: Optional[str] = None,
        urls: Optional[Sequence[MetricUrlArgs]] = None) -> Metric
func GetMetric(ctx *Context, name string, id IDInput, state *MetricState, opts ...ResourceOption) (*Metric, error)
public static Metric Get(string name, Input<string> id, MetricState? state, CustomResourceOptions? opts = null)
public static Metric get(String name, Output<String> id, MetricState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
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
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
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
The unique name of the resulting resource.
id
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
The unique name of the resulting resource.
id
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:
Description string

The description of the metric's purpose.

EventKey string

The event key to watch for custom metrics.

IsActive bool

Whether the metric is active

IsNumeric bool

Whether the metric is numeric

Key string

The unique key that references the metric. A change in this field will force the destruction of the existing resource and the creation of a new one.

Kind string

The metric type. Available choices are click, custom, and pageview. A change in this field will force the destruction of the existing resource and the creation of a new one.

MaintainerId string

The LaunchDarkly ID of the user who will maintain the metric. If not set, the API will automatically apply the member associated with your Terraform API key or the most recently-set maintainer

Name string

The human-friendly name for the metric.

ProjectKey string

The metrics's project key. A change in this field will force the destruction of the existing resource and the creation of a new one.

Selector string

The CSS selector for click metrics.

SuccessCriteria string

The success criteria for numeric custom metrics.

Tags List<string>

Set of tags for the metric.

Unit string

The unit for numeric custom metrics.

Urls List<Lbrlabs.PulumiPackage.Launchdarkly.Inputs.MetricUrlArgs>

A block determining which URLs the metric watches. To learn more, read Nested Urls Blocks.

Description string

The description of the metric's purpose.

EventKey string

The event key to watch for custom metrics.

IsActive bool

Whether the metric is active

IsNumeric bool

Whether the metric is numeric

Key string

The unique key that references the metric. A change in this field will force the destruction of the existing resource and the creation of a new one.

Kind string

The metric type. Available choices are click, custom, and pageview. A change in this field will force the destruction of the existing resource and the creation of a new one.

MaintainerId string

The LaunchDarkly ID of the user who will maintain the metric. If not set, the API will automatically apply the member associated with your Terraform API key or the most recently-set maintainer

Name string

The human-friendly name for the metric.

ProjectKey string

The metrics's project key. A change in this field will force the destruction of the existing resource and the creation of a new one.

Selector string

The CSS selector for click metrics.

SuccessCriteria string

The success criteria for numeric custom metrics.

Tags []string

Set of tags for the metric.

Unit string

The unit for numeric custom metrics.

Urls []MetricUrlArgs

A block determining which URLs the metric watches. To learn more, read Nested Urls Blocks.

description String

The description of the metric's purpose.

eventKey String

The event key to watch for custom metrics.

isActive Boolean

Whether the metric is active

isNumeric Boolean

Whether the metric is numeric

key String

The unique key that references the metric. A change in this field will force the destruction of the existing resource and the creation of a new one.

kind String

The metric type. Available choices are click, custom, and pageview. A change in this field will force the destruction of the existing resource and the creation of a new one.

maintainerId String

The LaunchDarkly ID of the user who will maintain the metric. If not set, the API will automatically apply the member associated with your Terraform API key or the most recently-set maintainer

name String

The human-friendly name for the metric.

projectKey String

The metrics's project key. A change in this field will force the destruction of the existing resource and the creation of a new one.

selector String

The CSS selector for click metrics.

successCriteria String

The success criteria for numeric custom metrics.

tags List<String>

Set of tags for the metric.

unit String

The unit for numeric custom metrics.

urls List<MetricUrlArgs>

A block determining which URLs the metric watches. To learn more, read Nested Urls Blocks.

description string

The description of the metric's purpose.

eventKey string

The event key to watch for custom metrics.

isActive boolean

Whether the metric is active

isNumeric boolean

Whether the metric is numeric

key string

The unique key that references the metric. A change in this field will force the destruction of the existing resource and the creation of a new one.

kind string

The metric type. Available choices are click, custom, and pageview. A change in this field will force the destruction of the existing resource and the creation of a new one.

maintainerId string

The LaunchDarkly ID of the user who will maintain the metric. If not set, the API will automatically apply the member associated with your Terraform API key or the most recently-set maintainer

name string

The human-friendly name for the metric.

projectKey string

The metrics's project key. A change in this field will force the destruction of the existing resource and the creation of a new one.

selector string

The CSS selector for click metrics.

successCriteria string

The success criteria for numeric custom metrics.

tags string[]

Set of tags for the metric.

unit string

The unit for numeric custom metrics.

urls MetricUrlArgs[]

A block determining which URLs the metric watches. To learn more, read Nested Urls Blocks.

description str

The description of the metric's purpose.

event_key str

The event key to watch for custom metrics.

is_active bool

Whether the metric is active

is_numeric bool

Whether the metric is numeric

key str

The unique key that references the metric. A change in this field will force the destruction of the existing resource and the creation of a new one.

kind str

The metric type. Available choices are click, custom, and pageview. A change in this field will force the destruction of the existing resource and the creation of a new one.

maintainer_id str

The LaunchDarkly ID of the user who will maintain the metric. If not set, the API will automatically apply the member associated with your Terraform API key or the most recently-set maintainer

name str

The human-friendly name for the metric.

project_key str

The metrics's project key. A change in this field will force the destruction of the existing resource and the creation of a new one.

selector str

The CSS selector for click metrics.

success_criteria str

The success criteria for numeric custom metrics.

tags Sequence[str]

Set of tags for the metric.

unit str

The unit for numeric custom metrics.

urls Sequence[MetricUrlArgs]

A block determining which URLs the metric watches. To learn more, read Nested Urls Blocks.

description String

The description of the metric's purpose.

eventKey String

The event key to watch for custom metrics.

isActive Boolean

Whether the metric is active

isNumeric Boolean

Whether the metric is numeric

key String

The unique key that references the metric. A change in this field will force the destruction of the existing resource and the creation of a new one.

kind String

The metric type. Available choices are click, custom, and pageview. A change in this field will force the destruction of the existing resource and the creation of a new one.

maintainerId String

The LaunchDarkly ID of the user who will maintain the metric. If not set, the API will automatically apply the member associated with your Terraform API key or the most recently-set maintainer

name String

The human-friendly name for the metric.

projectKey String

The metrics's project key. A change in this field will force the destruction of the existing resource and the creation of a new one.

selector String

The CSS selector for click metrics.

successCriteria String

The success criteria for numeric custom metrics.

tags List<String>

Set of tags for the metric.

unit String

The unit for numeric custom metrics.

urls List<Property Map>

A block determining which URLs the metric watches. To learn more, read Nested Urls Blocks.

Supporting Types

MetricUrl

Kind string

The URL type. Available choices are exact, canonical, substring and regex.

Pattern string

The regex pattern to match by.

Substring string

The URL substring to match by.

Url string

The exact or canonical URL.

Kind string

The URL type. Available choices are exact, canonical, substring and regex.

Pattern string

The regex pattern to match by.

Substring string

The URL substring to match by.

Url string

The exact or canonical URL.

kind String

The URL type. Available choices are exact, canonical, substring and regex.

pattern String

The regex pattern to match by.

substring String

The URL substring to match by.

url String

The exact or canonical URL.

kind string

The URL type. Available choices are exact, canonical, substring and regex.

pattern string

The regex pattern to match by.

substring string

The URL substring to match by.

url string

The exact or canonical URL.

kind str

The URL type. Available choices are exact, canonical, substring and regex.

pattern str

The regex pattern to match by.

substring str

The URL substring to match by.

url str

The exact or canonical URL.

kind String

The URL type. Available choices are exact, canonical, substring and regex.

pattern String

The regex pattern to match by.

substring String

The URL substring to match by.

url String

The exact or canonical URL.

Import

LaunchDarkly metrics can be imported using the metric’s ID in the form project_key/metric_key, e.g.

 $ pulumi import launchdarkly:index/metric:Metric example example-project/example-metric-key

Package Details

Repository
launchdarkly lbrlabs/pulumi-launchdarkly
License
Notes

This Pulumi package is based on the launchdarkly Terraform Provider.