launchdarkly.Metric
Explore with Pulumi AI
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
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Metric(name: string, args: MetricArgs, opts?: CustomResourceOptions);
@overload
def Metric(resource_name: str,
args: MetricArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Metric(resource_name: str,
opts: Optional[ResourceOptions] = None,
key: Optional[str] = None,
project_key: Optional[str] = None,
kind: Optional[str] = None,
maintainer_id: Optional[str] = None,
is_numeric: Optional[bool] = None,
is_active: Optional[bool] = None,
description: Optional[str] = None,
name: Optional[str] = None,
event_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)
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.
Parameters
- 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.
Constructor example
The following reference example uses placeholder values for all input properties.
var metricResource = new Launchdarkly.Metric("metricResource", new()
{
Key = "string",
ProjectKey = "string",
Kind = "string",
MaintainerId = "string",
IsNumeric = false,
IsActive = false,
Description = "string",
Name = "string",
EventKey = "string",
Selector = "string",
SuccessCriteria = "string",
Tags = new[]
{
"string",
},
Unit = "string",
Urls = new[]
{
new Launchdarkly.Inputs.MetricUrlArgs
{
Kind = "string",
Pattern = "string",
Substring = "string",
Url = "string",
},
},
});
example, err := launchdarkly.NewMetric(ctx, "metricResource", &launchdarkly.MetricArgs{
Key: pulumi.String("string"),
ProjectKey: pulumi.String("string"),
Kind: pulumi.String("string"),
MaintainerId: pulumi.String("string"),
IsNumeric: pulumi.Bool(false),
IsActive: pulumi.Bool(false),
Description: pulumi.String("string"),
Name: pulumi.String("string"),
EventKey: pulumi.String("string"),
Selector: pulumi.String("string"),
SuccessCriteria: pulumi.String("string"),
Tags: pulumi.StringArray{
pulumi.String("string"),
},
Unit: pulumi.String("string"),
Urls: launchdarkly.MetricUrlArray{
&launchdarkly.MetricUrlArgs{
Kind: pulumi.String("string"),
Pattern: pulumi.String("string"),
Substring: pulumi.String("string"),
Url: pulumi.String("string"),
},
},
})
var metricResource = new Metric("metricResource", MetricArgs.builder()
.key("string")
.projectKey("string")
.kind("string")
.maintainerId("string")
.isNumeric(false)
.isActive(false)
.description("string")
.name("string")
.eventKey("string")
.selector("string")
.successCriteria("string")
.tags("string")
.unit("string")
.urls(MetricUrlArgs.builder()
.kind("string")
.pattern("string")
.substring("string")
.url("string")
.build())
.build());
metric_resource = launchdarkly.Metric("metricResource",
key="string",
project_key="string",
kind="string",
maintainer_id="string",
is_numeric=False,
is_active=False,
description="string",
name="string",
event_key="string",
selector="string",
success_criteria="string",
tags=["string"],
unit="string",
urls=[launchdarkly.MetricUrlArgs(
kind="string",
pattern="string",
substring="string",
url="string",
)])
const metricResource = new launchdarkly.Metric("metricResource", {
key: "string",
projectKey: "string",
kind: "string",
maintainerId: "string",
isNumeric: false,
isActive: false,
description: "string",
name: "string",
eventKey: "string",
selector: "string",
successCriteria: "string",
tags: ["string"],
unit: "string",
urls: [{
kind: "string",
pattern: "string",
substring: "string",
url: "string",
}],
});
type: launchdarkly:Metric
properties:
description: string
eventKey: string
isActive: false
isNumeric: false
key: string
kind: string
maintainerId: string
name: string
projectKey: string
selector: string
successCriteria: string
tags:
- string
unit: string
urls:
- kind: string
pattern: string
substring: string
url: string
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
, andpageview
. A change in this field will force the destruction of the existing resource and the creation of a new one. - Project
Key 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.
- Event
Key string - 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 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. - Success
Criteria string - The success criteria for numeric
custom
metrics. - List<string>
- Set of tags for the metric.
- Unit string
- The unit for numeric
custom
metrics. - Urls
List<Lbrlabs.
Pulumi Package. Launchdarkly. Inputs. Metric Url> - 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
, andpageview
. A change in this field will force the destruction of the existing resource and the creation of a new one. - Project
Key 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.
- Event
Key string - 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 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. - Success
Criteria string - The success criteria for numeric
custom
metrics. - []string
- Set of tags for the metric.
- Unit string
- The unit for numeric
custom
metrics. - Urls
[]Metric
Url Args - 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
, andpageview
. A change in this field will force the destruction of the existing resource and the creation of a new one. - project
Key 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.
- event
Key String - The event key to watch for
custom
metrics. - is
Active Boolean - Whether the metric is active
- is
Numeric Boolean - Whether the metric is numeric
- maintainer
Id 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. - success
Criteria String - The success criteria for numeric
custom
metrics. - List<String>
- Set of tags for the metric.
- unit String
- The unit for numeric
custom
metrics. - urls
List<Metric
Url> - 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
, andpageview
. A change in this field will force the destruction of the existing resource and the creation of a new one. - project
Key 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.
- event
Key string - The event key to watch for
custom
metrics. - is
Active boolean - Whether the metric is active
- is
Numeric boolean - Whether the metric is numeric
- maintainer
Id 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. - success
Criteria string - The success criteria for numeric
custom
metrics. - string[]
- Set of tags for the metric.
- unit string
- The unit for numeric
custom
metrics. - urls
Metric
Url[] - 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
, andpageview
. 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. - Sequence[str]
- Set of tags for the metric.
- unit str
- The unit for numeric
custom
metrics. - urls
Sequence[Metric
Url Args] - 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
, andpageview
. A change in this field will force the destruction of the existing resource and the creation of a new one. - project
Key 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.
- event
Key String - The event key to watch for
custom
metrics. - is
Active Boolean - Whether the metric is active
- is
Numeric Boolean - Whether the metric is numeric
- maintainer
Id 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. - success
Criteria String - The success criteria for numeric
custom
metrics. - 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.
- Description string
- The description of the metric's purpose.
- Event
Key string - 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 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
, andpageview
. A change in this field will force the destruction of the existing resource and the creation of a new one. - Maintainer
Id 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.
- Project
Key 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. - Success
Criteria string - The success criteria for numeric
custom
metrics. - List<string>
- Set of tags for the metric.
- Unit string
- The unit for numeric
custom
metrics. - Urls
List<Lbrlabs.
Pulumi Package. Launchdarkly. Inputs. Metric Url> - A block determining which URLs the metric watches. To learn more, read Nested Urls Blocks.
- Description string
- The description of the metric's purpose.
- Event
Key string - 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 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
, andpageview
. A change in this field will force the destruction of the existing resource and the creation of a new one. - Maintainer
Id 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.
- Project
Key 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. - Success
Criteria string - The success criteria for numeric
custom
metrics. - []string
- Set of tags for the metric.
- Unit string
- The unit for numeric
custom
metrics. - Urls
[]Metric
Url Args - A block determining which URLs the metric watches. To learn more, read Nested Urls Blocks.
- description String
- The description of the metric's purpose.
- event
Key String - The event key to watch for
custom
metrics. - is
Active Boolean - Whether the metric is active
- is
Numeric 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
, andpageview
. A change in this field will force the destruction of the existing resource and the creation of a new one. - maintainer
Id 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.
- project
Key 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. - success
Criteria String - The success criteria for numeric
custom
metrics. - List<String>
- Set of tags for the metric.
- unit String
- The unit for numeric
custom
metrics. - urls
List<Metric
Url> - A block determining which URLs the metric watches. To learn more, read Nested Urls Blocks.
- description string
- The description of the metric's purpose.
- event
Key string - The event key to watch for
custom
metrics. - is
Active boolean - Whether the metric is active
- is
Numeric 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
, andpageview
. A change in this field will force the destruction of the existing resource and the creation of a new one. - maintainer
Id 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.
- project
Key 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. - success
Criteria string - The success criteria for numeric
custom
metrics. - string[]
- Set of tags for the metric.
- unit string
- The unit for numeric
custom
metrics. - urls
Metric
Url[] - 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
, andpageview
. 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. - Sequence[str]
- Set of tags for the metric.
- unit str
- The unit for numeric
custom
metrics. - urls
Sequence[Metric
Url Args] - A block determining which URLs the metric watches. To learn more, read Nested Urls Blocks.
- description String
- The description of the metric's purpose.
- event
Key String - The event key to watch for
custom
metrics. - is
Active Boolean - Whether the metric is active
- is
Numeric 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
, andpageview
. A change in this field will force the destruction of the existing resource and the creation of a new one. - maintainer
Id 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.
- project
Key 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. - success
Criteria String - The success criteria for numeric
custom
metrics. - 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, MetricUrlArgs
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
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- launchdarkly lbrlabs/pulumi-launchdarkly
- License
- Notes
- This Pulumi package is based on the
launchdarkly
Terraform Provider.