1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. monitoring
  5. MetricDescriptor
Google Cloud Classic v7.19.0 published on Thursday, Apr 18, 2024 by Pulumi

gcp.monitoring.MetricDescriptor

Explore with Pulumi AI

gcp logo
Google Cloud Classic v7.19.0 published on Thursday, Apr 18, 2024 by Pulumi

    Defines a metric type and its schema. Once a metric descriptor is created, deleting or altering it stops data collection and makes the metric type’s existing data unusable.

    To get more information about MetricDescriptor, see:

    Example Usage

    Monitoring Metric Descriptor Basic

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const basic = new gcp.monitoring.MetricDescriptor("basic", {
        description: "Daily sales records from all branch stores.",
        displayName: "metric-descriptor",
        type: "custom.googleapis.com/stores/daily_sales",
        metricKind: "GAUGE",
        valueType: "DOUBLE",
        unit: "{USD}",
        labels: [{
            key: "store_id",
            valueType: "STRING",
            description: "The ID of the store.",
        }],
        launchStage: "BETA",
        metadata: {
            samplePeriod: "60s",
            ingestDelay: "30s",
        },
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    basic = gcp.monitoring.MetricDescriptor("basic",
        description="Daily sales records from all branch stores.",
        display_name="metric-descriptor",
        type="custom.googleapis.com/stores/daily_sales",
        metric_kind="GAUGE",
        value_type="DOUBLE",
        unit="{USD}",
        labels=[gcp.monitoring.MetricDescriptorLabelArgs(
            key="store_id",
            value_type="STRING",
            description="The ID of the store.",
        )],
        launch_stage="BETA",
        metadata=gcp.monitoring.MetricDescriptorMetadataArgs(
            sample_period="60s",
            ingest_delay="30s",
        ))
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/monitoring"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := monitoring.NewMetricDescriptor(ctx, "basic", &monitoring.MetricDescriptorArgs{
    			Description: pulumi.String("Daily sales records from all branch stores."),
    			DisplayName: pulumi.String("metric-descriptor"),
    			Type:        pulumi.String("custom.googleapis.com/stores/daily_sales"),
    			MetricKind:  pulumi.String("GAUGE"),
    			ValueType:   pulumi.String("DOUBLE"),
    			Unit:        pulumi.String("{USD}"),
    			Labels: monitoring.MetricDescriptorLabelArray{
    				&monitoring.MetricDescriptorLabelArgs{
    					Key:         pulumi.String("store_id"),
    					ValueType:   pulumi.String("STRING"),
    					Description: pulumi.String("The ID of the store."),
    				},
    			},
    			LaunchStage: pulumi.String("BETA"),
    			Metadata: &monitoring.MetricDescriptorMetadataArgs{
    				SamplePeriod: pulumi.String("60s"),
    				IngestDelay:  pulumi.String("30s"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var basic = new Gcp.Monitoring.MetricDescriptor("basic", new()
        {
            Description = "Daily sales records from all branch stores.",
            DisplayName = "metric-descriptor",
            Type = "custom.googleapis.com/stores/daily_sales",
            MetricKind = "GAUGE",
            ValueType = "DOUBLE",
            Unit = "{USD}",
            Labels = new[]
            {
                new Gcp.Monitoring.Inputs.MetricDescriptorLabelArgs
                {
                    Key = "store_id",
                    ValueType = "STRING",
                    Description = "The ID of the store.",
                },
            },
            LaunchStage = "BETA",
            Metadata = new Gcp.Monitoring.Inputs.MetricDescriptorMetadataArgs
            {
                SamplePeriod = "60s",
                IngestDelay = "30s",
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.monitoring.MetricDescriptor;
    import com.pulumi.gcp.monitoring.MetricDescriptorArgs;
    import com.pulumi.gcp.monitoring.inputs.MetricDescriptorLabelArgs;
    import com.pulumi.gcp.monitoring.inputs.MetricDescriptorMetadataArgs;
    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 basic = new MetricDescriptor("basic", MetricDescriptorArgs.builder()        
                .description("Daily sales records from all branch stores.")
                .displayName("metric-descriptor")
                .type("custom.googleapis.com/stores/daily_sales")
                .metricKind("GAUGE")
                .valueType("DOUBLE")
                .unit("{USD}")
                .labels(MetricDescriptorLabelArgs.builder()
                    .key("store_id")
                    .valueType("STRING")
                    .description("The ID of the store.")
                    .build())
                .launchStage("BETA")
                .metadata(MetricDescriptorMetadataArgs.builder()
                    .samplePeriod("60s")
                    .ingestDelay("30s")
                    .build())
                .build());
    
        }
    }
    
    resources:
      basic:
        type: gcp:monitoring:MetricDescriptor
        properties:
          description: Daily sales records from all branch stores.
          displayName: metric-descriptor
          type: custom.googleapis.com/stores/daily_sales
          metricKind: GAUGE
          valueType: DOUBLE
          unit: '{USD}'
          labels:
            - key: store_id
              valueType: STRING
              description: The ID of the store.
          launchStage: BETA
          metadata:
            samplePeriod: 60s
            ingestDelay: 30s
    

    Monitoring Metric Descriptor Alert

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const withAlert = new gcp.monitoring.MetricDescriptor("with_alert", {
        description: "Daily sales records from all branch stores.",
        displayName: "metric-descriptor",
        type: "custom.googleapis.com/stores/daily_sales",
        metricKind: "GAUGE",
        valueType: "DOUBLE",
        unit: "{USD}",
    });
    const alertPolicy = new gcp.monitoring.AlertPolicy("alert_policy", {
        displayName: "metric-descriptor",
        combiner: "OR",
        conditions: [{
            displayName: "test condition",
            conditionThreshold: {
                filter: pulumi.interpolate`metric.type="${withAlert.type}" AND resource.type="gce_instance"`,
                duration: "60s",
                comparison: "COMPARISON_GT",
            },
        }],
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    with_alert = gcp.monitoring.MetricDescriptor("with_alert",
        description="Daily sales records from all branch stores.",
        display_name="metric-descriptor",
        type="custom.googleapis.com/stores/daily_sales",
        metric_kind="GAUGE",
        value_type="DOUBLE",
        unit="{USD}")
    alert_policy = gcp.monitoring.AlertPolicy("alert_policy",
        display_name="metric-descriptor",
        combiner="OR",
        conditions=[gcp.monitoring.AlertPolicyConditionArgs(
            display_name="test condition",
            condition_threshold=gcp.monitoring.AlertPolicyConditionConditionThresholdArgs(
                filter=with_alert.type.apply(lambda type: f"metric.type=\"{type}\" AND resource.type=\"gce_instance\""),
                duration="60s",
                comparison="COMPARISON_GT",
            ),
        )])
    
    package main
    
    import (
    	"fmt"
    
    	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/monitoring"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		withAlert, err := monitoring.NewMetricDescriptor(ctx, "with_alert", &monitoring.MetricDescriptorArgs{
    			Description: pulumi.String("Daily sales records from all branch stores."),
    			DisplayName: pulumi.String("metric-descriptor"),
    			Type:        pulumi.String("custom.googleapis.com/stores/daily_sales"),
    			MetricKind:  pulumi.String("GAUGE"),
    			ValueType:   pulumi.String("DOUBLE"),
    			Unit:        pulumi.String("{USD}"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = monitoring.NewAlertPolicy(ctx, "alert_policy", &monitoring.AlertPolicyArgs{
    			DisplayName: pulumi.String("metric-descriptor"),
    			Combiner:    pulumi.String("OR"),
    			Conditions: monitoring.AlertPolicyConditionArray{
    				&monitoring.AlertPolicyConditionArgs{
    					DisplayName: pulumi.String("test condition"),
    					ConditionThreshold: &monitoring.AlertPolicyConditionConditionThresholdArgs{
    						Filter: withAlert.Type.ApplyT(func(_type string) (string, error) {
    							return fmt.Sprintf("metric.type=\"%v\" AND resource.type=\"gce_instance\"", _type), nil
    						}).(pulumi.StringOutput),
    						Duration:   pulumi.String("60s"),
    						Comparison: pulumi.String("COMPARISON_GT"),
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var withAlert = new Gcp.Monitoring.MetricDescriptor("with_alert", new()
        {
            Description = "Daily sales records from all branch stores.",
            DisplayName = "metric-descriptor",
            Type = "custom.googleapis.com/stores/daily_sales",
            MetricKind = "GAUGE",
            ValueType = "DOUBLE",
            Unit = "{USD}",
        });
    
        var alertPolicy = new Gcp.Monitoring.AlertPolicy("alert_policy", new()
        {
            DisplayName = "metric-descriptor",
            Combiner = "OR",
            Conditions = new[]
            {
                new Gcp.Monitoring.Inputs.AlertPolicyConditionArgs
                {
                    DisplayName = "test condition",
                    ConditionThreshold = new Gcp.Monitoring.Inputs.AlertPolicyConditionConditionThresholdArgs
                    {
                        Filter = withAlert.Type.Apply(type => $"metric.type=\"{type}\" AND resource.type=\"gce_instance\""),
                        Duration = "60s",
                        Comparison = "COMPARISON_GT",
                    },
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.monitoring.MetricDescriptor;
    import com.pulumi.gcp.monitoring.MetricDescriptorArgs;
    import com.pulumi.gcp.monitoring.AlertPolicy;
    import com.pulumi.gcp.monitoring.AlertPolicyArgs;
    import com.pulumi.gcp.monitoring.inputs.AlertPolicyConditionArgs;
    import com.pulumi.gcp.monitoring.inputs.AlertPolicyConditionConditionThresholdArgs;
    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 withAlert = new MetricDescriptor("withAlert", MetricDescriptorArgs.builder()        
                .description("Daily sales records from all branch stores.")
                .displayName("metric-descriptor")
                .type("custom.googleapis.com/stores/daily_sales")
                .metricKind("GAUGE")
                .valueType("DOUBLE")
                .unit("{USD}")
                .build());
    
            var alertPolicy = new AlertPolicy("alertPolicy", AlertPolicyArgs.builder()        
                .displayName("metric-descriptor")
                .combiner("OR")
                .conditions(AlertPolicyConditionArgs.builder()
                    .displayName("test condition")
                    .conditionThreshold(AlertPolicyConditionConditionThresholdArgs.builder()
                        .filter(withAlert.type().applyValue(type -> String.format("metric.type=\"%s\" AND resource.type=\"gce_instance\"", type)))
                        .duration("60s")
                        .comparison("COMPARISON_GT")
                        .build())
                    .build())
                .build());
    
        }
    }
    
    resources:
      withAlert:
        type: gcp:monitoring:MetricDescriptor
        name: with_alert
        properties:
          description: Daily sales records from all branch stores.
          displayName: metric-descriptor
          type: custom.googleapis.com/stores/daily_sales
          metricKind: GAUGE
          valueType: DOUBLE
          unit: '{USD}'
      alertPolicy:
        type: gcp:monitoring:AlertPolicy
        name: alert_policy
        properties:
          displayName: metric-descriptor
          combiner: OR
          conditions:
            - displayName: test condition
              conditionThreshold:
                filter: metric.type="${withAlert.type}" AND resource.type="gce_instance"
                duration: 60s
                comparison: COMPARISON_GT
    

    Create MetricDescriptor Resource

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

    Constructor syntax

    new MetricDescriptor(name: string, args: MetricDescriptorArgs, opts?: CustomResourceOptions);
    @overload
    def MetricDescriptor(resource_name: str,
                         args: MetricDescriptorArgs,
                         opts: Optional[ResourceOptions] = None)
    
    @overload
    def MetricDescriptor(resource_name: str,
                         opts: Optional[ResourceOptions] = None,
                         description: Optional[str] = None,
                         display_name: Optional[str] = None,
                         metric_kind: Optional[str] = None,
                         type: Optional[str] = None,
                         value_type: Optional[str] = None,
                         labels: Optional[Sequence[MetricDescriptorLabelArgs]] = None,
                         launch_stage: Optional[str] = None,
                         metadata: Optional[MetricDescriptorMetadataArgs] = None,
                         project: Optional[str] = None,
                         unit: Optional[str] = None)
    func NewMetricDescriptor(ctx *Context, name string, args MetricDescriptorArgs, opts ...ResourceOption) (*MetricDescriptor, error)
    public MetricDescriptor(string name, MetricDescriptorArgs args, CustomResourceOptions? opts = null)
    public MetricDescriptor(String name, MetricDescriptorArgs args)
    public MetricDescriptor(String name, MetricDescriptorArgs args, CustomResourceOptions options)
    
    type: gcp:monitoring:MetricDescriptor
    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 MetricDescriptorArgs
    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 MetricDescriptorArgs
    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 MetricDescriptorArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args MetricDescriptorArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args MetricDescriptorArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

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

    var metricDescriptorResource = new Gcp.Monitoring.MetricDescriptor("metricDescriptorResource", new()
    {
        Description = "string",
        DisplayName = "string",
        MetricKind = "string",
        Type = "string",
        ValueType = "string",
        Labels = new[]
        {
            new Gcp.Monitoring.Inputs.MetricDescriptorLabelArgs
            {
                Key = "string",
                Description = "string",
                ValueType = "string",
            },
        },
        LaunchStage = "string",
        Metadata = new Gcp.Monitoring.Inputs.MetricDescriptorMetadataArgs
        {
            IngestDelay = "string",
            SamplePeriod = "string",
        },
        Project = "string",
        Unit = "string",
    });
    
    example, err := monitoring.NewMetricDescriptor(ctx, "metricDescriptorResource", &monitoring.MetricDescriptorArgs{
    	Description: pulumi.String("string"),
    	DisplayName: pulumi.String("string"),
    	MetricKind:  pulumi.String("string"),
    	Type:        pulumi.String("string"),
    	ValueType:   pulumi.String("string"),
    	Labels: monitoring.MetricDescriptorLabelArray{
    		&monitoring.MetricDescriptorLabelArgs{
    			Key:         pulumi.String("string"),
    			Description: pulumi.String("string"),
    			ValueType:   pulumi.String("string"),
    		},
    	},
    	LaunchStage: pulumi.String("string"),
    	Metadata: &monitoring.MetricDescriptorMetadataArgs{
    		IngestDelay:  pulumi.String("string"),
    		SamplePeriod: pulumi.String("string"),
    	},
    	Project: pulumi.String("string"),
    	Unit:    pulumi.String("string"),
    })
    
    var metricDescriptorResource = new MetricDescriptor("metricDescriptorResource", MetricDescriptorArgs.builder()        
        .description("string")
        .displayName("string")
        .metricKind("string")
        .type("string")
        .valueType("string")
        .labels(MetricDescriptorLabelArgs.builder()
            .key("string")
            .description("string")
            .valueType("string")
            .build())
        .launchStage("string")
        .metadata(MetricDescriptorMetadataArgs.builder()
            .ingestDelay("string")
            .samplePeriod("string")
            .build())
        .project("string")
        .unit("string")
        .build());
    
    metric_descriptor_resource = gcp.monitoring.MetricDescriptor("metricDescriptorResource",
        description="string",
        display_name="string",
        metric_kind="string",
        type="string",
        value_type="string",
        labels=[gcp.monitoring.MetricDescriptorLabelArgs(
            key="string",
            description="string",
            value_type="string",
        )],
        launch_stage="string",
        metadata=gcp.monitoring.MetricDescriptorMetadataArgs(
            ingest_delay="string",
            sample_period="string",
        ),
        project="string",
        unit="string")
    
    const metricDescriptorResource = new gcp.monitoring.MetricDescriptor("metricDescriptorResource", {
        description: "string",
        displayName: "string",
        metricKind: "string",
        type: "string",
        valueType: "string",
        labels: [{
            key: "string",
            description: "string",
            valueType: "string",
        }],
        launchStage: "string",
        metadata: {
            ingestDelay: "string",
            samplePeriod: "string",
        },
        project: "string",
        unit: "string",
    });
    
    type: gcp:monitoring:MetricDescriptor
    properties:
        description: string
        displayName: string
        labels:
            - description: string
              key: string
              valueType: string
        launchStage: string
        metadata:
            ingestDelay: string
            samplePeriod: string
        metricKind: string
        project: string
        type: string
        unit: string
        valueType: string
    

    MetricDescriptor 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 MetricDescriptor resource accepts the following input properties:

    Description string
    A detailed description of the metric, which can be used in documentation.
    DisplayName string
    A concise name for the metric, which can be displayed in user interfaces. Use sentence case without an ending period, for example "Request count".


    MetricKind string
    Whether the metric records instantaneous values, changes to a value, etc. Some combinations of metricKind and valueType might not be supported. Possible values are: METRIC_KIND_UNSPECIFIED, GAUGE, DELTA, CUMULATIVE.
    Type string
    The metric type, including its DNS name prefix. The type is not URL-encoded. All service defined metrics must be prefixed with the service name, in the format of {service name}/{relative metric name}, such as cloudsql.googleapis.com/database/cpu/utilization. The relative metric name must have only upper and lower-case letters, digits, '/' and underscores '_' are allowed. Additionally, the maximum number of characters allowed for the relative_metric_name is 100. All user-defined metric types have the DNS name custom.googleapis.com, external.googleapis.com, or logging.googleapis.com/user/.
    ValueType string
    Whether the measurement is an integer, a floating-point number, etc. Some combinations of metricKind and valueType might not be supported. Possible values are: BOOL, INT64, DOUBLE, STRING, DISTRIBUTION.
    Labels List<MetricDescriptorLabel>
    The set of labels that can be used to describe a specific instance of this metric type. In order to delete a label, the entire resource must be deleted, then created with the desired labels. Structure is documented below.
    LaunchStage string
    The launch stage of the metric definition. Possible values are: LAUNCH_STAGE_UNSPECIFIED, UNIMPLEMENTED, PRELAUNCH, EARLY_ACCESS, ALPHA, BETA, GA, DEPRECATED.
    Metadata MetricDescriptorMetadata
    Metadata which can be used to guide usage of the metric. Structure is documented below.
    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    Unit string
    The units in which the metric value is reported. It is only applicable if the valueType is INT64, DOUBLE, or DISTRIBUTION. The unit defines the representation of the stored metric values. Different systems may scale the values to be more easily displayed (so a value of 0.02KBy might be displayed as 20By, and a value of 3523KBy might be displayed as 3.5MBy). However, if the unit is KBy, then the value of the metric is always in thousands of bytes, no matter how it may be displayed. If you want a custom metric to record the exact number of CPU-seconds used by a job, you can create an INT64 CUMULATIVE metric whose unit is s{CPU} (or equivalently 1s{CPU} or just s). If the job uses 12,005 CPU-seconds, then the value is written as 12005. Alternatively, if you want a custom metric to record data in a more granular way, you can create a DOUBLE CUMULATIVE metric whose unit is ks{CPU}, and then write the value 12.005 (which is 12005/1000), or use Kis{CPU} and write 11.723 (which is 12005/1024). The supported units are a subset of The Unified Code for Units of Measure standard. More info can be found in the API documentation (https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.metricDescriptors).
    Description string
    A detailed description of the metric, which can be used in documentation.
    DisplayName string
    A concise name for the metric, which can be displayed in user interfaces. Use sentence case without an ending period, for example "Request count".


    MetricKind string
    Whether the metric records instantaneous values, changes to a value, etc. Some combinations of metricKind and valueType might not be supported. Possible values are: METRIC_KIND_UNSPECIFIED, GAUGE, DELTA, CUMULATIVE.
    Type string
    The metric type, including its DNS name prefix. The type is not URL-encoded. All service defined metrics must be prefixed with the service name, in the format of {service name}/{relative metric name}, such as cloudsql.googleapis.com/database/cpu/utilization. The relative metric name must have only upper and lower-case letters, digits, '/' and underscores '_' are allowed. Additionally, the maximum number of characters allowed for the relative_metric_name is 100. All user-defined metric types have the DNS name custom.googleapis.com, external.googleapis.com, or logging.googleapis.com/user/.
    ValueType string
    Whether the measurement is an integer, a floating-point number, etc. Some combinations of metricKind and valueType might not be supported. Possible values are: BOOL, INT64, DOUBLE, STRING, DISTRIBUTION.
    Labels []MetricDescriptorLabelArgs
    The set of labels that can be used to describe a specific instance of this metric type. In order to delete a label, the entire resource must be deleted, then created with the desired labels. Structure is documented below.
    LaunchStage string
    The launch stage of the metric definition. Possible values are: LAUNCH_STAGE_UNSPECIFIED, UNIMPLEMENTED, PRELAUNCH, EARLY_ACCESS, ALPHA, BETA, GA, DEPRECATED.
    Metadata MetricDescriptorMetadataArgs
    Metadata which can be used to guide usage of the metric. Structure is documented below.
    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    Unit string
    The units in which the metric value is reported. It is only applicable if the valueType is INT64, DOUBLE, or DISTRIBUTION. The unit defines the representation of the stored metric values. Different systems may scale the values to be more easily displayed (so a value of 0.02KBy might be displayed as 20By, and a value of 3523KBy might be displayed as 3.5MBy). However, if the unit is KBy, then the value of the metric is always in thousands of bytes, no matter how it may be displayed. If you want a custom metric to record the exact number of CPU-seconds used by a job, you can create an INT64 CUMULATIVE metric whose unit is s{CPU} (or equivalently 1s{CPU} or just s). If the job uses 12,005 CPU-seconds, then the value is written as 12005. Alternatively, if you want a custom metric to record data in a more granular way, you can create a DOUBLE CUMULATIVE metric whose unit is ks{CPU}, and then write the value 12.005 (which is 12005/1000), or use Kis{CPU} and write 11.723 (which is 12005/1024). The supported units are a subset of The Unified Code for Units of Measure standard. More info can be found in the API documentation (https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.metricDescriptors).
    description String
    A detailed description of the metric, which can be used in documentation.
    displayName String
    A concise name for the metric, which can be displayed in user interfaces. Use sentence case without an ending period, for example "Request count".


    metricKind String
    Whether the metric records instantaneous values, changes to a value, etc. Some combinations of metricKind and valueType might not be supported. Possible values are: METRIC_KIND_UNSPECIFIED, GAUGE, DELTA, CUMULATIVE.
    type String
    The metric type, including its DNS name prefix. The type is not URL-encoded. All service defined metrics must be prefixed with the service name, in the format of {service name}/{relative metric name}, such as cloudsql.googleapis.com/database/cpu/utilization. The relative metric name must have only upper and lower-case letters, digits, '/' and underscores '_' are allowed. Additionally, the maximum number of characters allowed for the relative_metric_name is 100. All user-defined metric types have the DNS name custom.googleapis.com, external.googleapis.com, or logging.googleapis.com/user/.
    valueType String
    Whether the measurement is an integer, a floating-point number, etc. Some combinations of metricKind and valueType might not be supported. Possible values are: BOOL, INT64, DOUBLE, STRING, DISTRIBUTION.
    labels List<MetricDescriptorLabel>
    The set of labels that can be used to describe a specific instance of this metric type. In order to delete a label, the entire resource must be deleted, then created with the desired labels. Structure is documented below.
    launchStage String
    The launch stage of the metric definition. Possible values are: LAUNCH_STAGE_UNSPECIFIED, UNIMPLEMENTED, PRELAUNCH, EARLY_ACCESS, ALPHA, BETA, GA, DEPRECATED.
    metadata MetricDescriptorMetadata
    Metadata which can be used to guide usage of the metric. Structure is documented below.
    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    unit String
    The units in which the metric value is reported. It is only applicable if the valueType is INT64, DOUBLE, or DISTRIBUTION. The unit defines the representation of the stored metric values. Different systems may scale the values to be more easily displayed (so a value of 0.02KBy might be displayed as 20By, and a value of 3523KBy might be displayed as 3.5MBy). However, if the unit is KBy, then the value of the metric is always in thousands of bytes, no matter how it may be displayed. If you want a custom metric to record the exact number of CPU-seconds used by a job, you can create an INT64 CUMULATIVE metric whose unit is s{CPU} (or equivalently 1s{CPU} or just s). If the job uses 12,005 CPU-seconds, then the value is written as 12005. Alternatively, if you want a custom metric to record data in a more granular way, you can create a DOUBLE CUMULATIVE metric whose unit is ks{CPU}, and then write the value 12.005 (which is 12005/1000), or use Kis{CPU} and write 11.723 (which is 12005/1024). The supported units are a subset of The Unified Code for Units of Measure standard. More info can be found in the API documentation (https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.metricDescriptors).
    description string
    A detailed description of the metric, which can be used in documentation.
    displayName string
    A concise name for the metric, which can be displayed in user interfaces. Use sentence case without an ending period, for example "Request count".


    metricKind string
    Whether the metric records instantaneous values, changes to a value, etc. Some combinations of metricKind and valueType might not be supported. Possible values are: METRIC_KIND_UNSPECIFIED, GAUGE, DELTA, CUMULATIVE.
    type string
    The metric type, including its DNS name prefix. The type is not URL-encoded. All service defined metrics must be prefixed with the service name, in the format of {service name}/{relative metric name}, such as cloudsql.googleapis.com/database/cpu/utilization. The relative metric name must have only upper and lower-case letters, digits, '/' and underscores '_' are allowed. Additionally, the maximum number of characters allowed for the relative_metric_name is 100. All user-defined metric types have the DNS name custom.googleapis.com, external.googleapis.com, or logging.googleapis.com/user/.
    valueType string
    Whether the measurement is an integer, a floating-point number, etc. Some combinations of metricKind and valueType might not be supported. Possible values are: BOOL, INT64, DOUBLE, STRING, DISTRIBUTION.
    labels MetricDescriptorLabel[]
    The set of labels that can be used to describe a specific instance of this metric type. In order to delete a label, the entire resource must be deleted, then created with the desired labels. Structure is documented below.
    launchStage string
    The launch stage of the metric definition. Possible values are: LAUNCH_STAGE_UNSPECIFIED, UNIMPLEMENTED, PRELAUNCH, EARLY_ACCESS, ALPHA, BETA, GA, DEPRECATED.
    metadata MetricDescriptorMetadata
    Metadata which can be used to guide usage of the metric. Structure is documented below.
    project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    unit string
    The units in which the metric value is reported. It is only applicable if the valueType is INT64, DOUBLE, or DISTRIBUTION. The unit defines the representation of the stored metric values. Different systems may scale the values to be more easily displayed (so a value of 0.02KBy might be displayed as 20By, and a value of 3523KBy might be displayed as 3.5MBy). However, if the unit is KBy, then the value of the metric is always in thousands of bytes, no matter how it may be displayed. If you want a custom metric to record the exact number of CPU-seconds used by a job, you can create an INT64 CUMULATIVE metric whose unit is s{CPU} (or equivalently 1s{CPU} or just s). If the job uses 12,005 CPU-seconds, then the value is written as 12005. Alternatively, if you want a custom metric to record data in a more granular way, you can create a DOUBLE CUMULATIVE metric whose unit is ks{CPU}, and then write the value 12.005 (which is 12005/1000), or use Kis{CPU} and write 11.723 (which is 12005/1024). The supported units are a subset of The Unified Code for Units of Measure standard. More info can be found in the API documentation (https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.metricDescriptors).
    description str
    A detailed description of the metric, which can be used in documentation.
    display_name str
    A concise name for the metric, which can be displayed in user interfaces. Use sentence case without an ending period, for example "Request count".


    metric_kind str
    Whether the metric records instantaneous values, changes to a value, etc. Some combinations of metricKind and valueType might not be supported. Possible values are: METRIC_KIND_UNSPECIFIED, GAUGE, DELTA, CUMULATIVE.
    type str
    The metric type, including its DNS name prefix. The type is not URL-encoded. All service defined metrics must be prefixed with the service name, in the format of {service name}/{relative metric name}, such as cloudsql.googleapis.com/database/cpu/utilization. The relative metric name must have only upper and lower-case letters, digits, '/' and underscores '_' are allowed. Additionally, the maximum number of characters allowed for the relative_metric_name is 100. All user-defined metric types have the DNS name custom.googleapis.com, external.googleapis.com, or logging.googleapis.com/user/.
    value_type str
    Whether the measurement is an integer, a floating-point number, etc. Some combinations of metricKind and valueType might not be supported. Possible values are: BOOL, INT64, DOUBLE, STRING, DISTRIBUTION.
    labels Sequence[MetricDescriptorLabelArgs]
    The set of labels that can be used to describe a specific instance of this metric type. In order to delete a label, the entire resource must be deleted, then created with the desired labels. Structure is documented below.
    launch_stage str
    The launch stage of the metric definition. Possible values are: LAUNCH_STAGE_UNSPECIFIED, UNIMPLEMENTED, PRELAUNCH, EARLY_ACCESS, ALPHA, BETA, GA, DEPRECATED.
    metadata MetricDescriptorMetadataArgs
    Metadata which can be used to guide usage of the metric. Structure is documented below.
    project str
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    unit str
    The units in which the metric value is reported. It is only applicable if the valueType is INT64, DOUBLE, or DISTRIBUTION. The unit defines the representation of the stored metric values. Different systems may scale the values to be more easily displayed (so a value of 0.02KBy might be displayed as 20By, and a value of 3523KBy might be displayed as 3.5MBy). However, if the unit is KBy, then the value of the metric is always in thousands of bytes, no matter how it may be displayed. If you want a custom metric to record the exact number of CPU-seconds used by a job, you can create an INT64 CUMULATIVE metric whose unit is s{CPU} (or equivalently 1s{CPU} or just s). If the job uses 12,005 CPU-seconds, then the value is written as 12005. Alternatively, if you want a custom metric to record data in a more granular way, you can create a DOUBLE CUMULATIVE metric whose unit is ks{CPU}, and then write the value 12.005 (which is 12005/1000), or use Kis{CPU} and write 11.723 (which is 12005/1024). The supported units are a subset of The Unified Code for Units of Measure standard. More info can be found in the API documentation (https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.metricDescriptors).
    description String
    A detailed description of the metric, which can be used in documentation.
    displayName String
    A concise name for the metric, which can be displayed in user interfaces. Use sentence case without an ending period, for example "Request count".


    metricKind String
    Whether the metric records instantaneous values, changes to a value, etc. Some combinations of metricKind and valueType might not be supported. Possible values are: METRIC_KIND_UNSPECIFIED, GAUGE, DELTA, CUMULATIVE.
    type String
    The metric type, including its DNS name prefix. The type is not URL-encoded. All service defined metrics must be prefixed with the service name, in the format of {service name}/{relative metric name}, such as cloudsql.googleapis.com/database/cpu/utilization. The relative metric name must have only upper and lower-case letters, digits, '/' and underscores '_' are allowed. Additionally, the maximum number of characters allowed for the relative_metric_name is 100. All user-defined metric types have the DNS name custom.googleapis.com, external.googleapis.com, or logging.googleapis.com/user/.
    valueType String
    Whether the measurement is an integer, a floating-point number, etc. Some combinations of metricKind and valueType might not be supported. Possible values are: BOOL, INT64, DOUBLE, STRING, DISTRIBUTION.
    labels List<Property Map>
    The set of labels that can be used to describe a specific instance of this metric type. In order to delete a label, the entire resource must be deleted, then created with the desired labels. Structure is documented below.
    launchStage String
    The launch stage of the metric definition. Possible values are: LAUNCH_STAGE_UNSPECIFIED, UNIMPLEMENTED, PRELAUNCH, EARLY_ACCESS, ALPHA, BETA, GA, DEPRECATED.
    metadata Property Map
    Metadata which can be used to guide usage of the metric. Structure is documented below.
    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    unit String
    The units in which the metric value is reported. It is only applicable if the valueType is INT64, DOUBLE, or DISTRIBUTION. The unit defines the representation of the stored metric values. Different systems may scale the values to be more easily displayed (so a value of 0.02KBy might be displayed as 20By, and a value of 3523KBy might be displayed as 3.5MBy). However, if the unit is KBy, then the value of the metric is always in thousands of bytes, no matter how it may be displayed. If you want a custom metric to record the exact number of CPU-seconds used by a job, you can create an INT64 CUMULATIVE metric whose unit is s{CPU} (or equivalently 1s{CPU} or just s). If the job uses 12,005 CPU-seconds, then the value is written as 12005. Alternatively, if you want a custom metric to record data in a more granular way, you can create a DOUBLE CUMULATIVE metric whose unit is ks{CPU}, and then write the value 12.005 (which is 12005/1000), or use Kis{CPU} and write 11.723 (which is 12005/1024). The supported units are a subset of The Unified Code for Units of Measure standard. More info can be found in the API documentation (https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.metricDescriptors).

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    MonitoredResourceTypes List<string>
    If present, then a time series, which is identified partially by a metric type and a MonitoredResourceDescriptor, that is associated with this metric type can only be associated with one of the monitored resource types listed here. This field allows time series to be associated with the intersection of this metric type and the monitored resource types in this list.
    Name string
    The resource name of the metric descriptor.
    Id string
    The provider-assigned unique ID for this managed resource.
    MonitoredResourceTypes []string
    If present, then a time series, which is identified partially by a metric type and a MonitoredResourceDescriptor, that is associated with this metric type can only be associated with one of the monitored resource types listed here. This field allows time series to be associated with the intersection of this metric type and the monitored resource types in this list.
    Name string
    The resource name of the metric descriptor.
    id String
    The provider-assigned unique ID for this managed resource.
    monitoredResourceTypes List<String>
    If present, then a time series, which is identified partially by a metric type and a MonitoredResourceDescriptor, that is associated with this metric type can only be associated with one of the monitored resource types listed here. This field allows time series to be associated with the intersection of this metric type and the monitored resource types in this list.
    name String
    The resource name of the metric descriptor.
    id string
    The provider-assigned unique ID for this managed resource.
    monitoredResourceTypes string[]
    If present, then a time series, which is identified partially by a metric type and a MonitoredResourceDescriptor, that is associated with this metric type can only be associated with one of the monitored resource types listed here. This field allows time series to be associated with the intersection of this metric type and the monitored resource types in this list.
    name string
    The resource name of the metric descriptor.
    id str
    The provider-assigned unique ID for this managed resource.
    monitored_resource_types Sequence[str]
    If present, then a time series, which is identified partially by a metric type and a MonitoredResourceDescriptor, that is associated with this metric type can only be associated with one of the monitored resource types listed here. This field allows time series to be associated with the intersection of this metric type and the monitored resource types in this list.
    name str
    The resource name of the metric descriptor.
    id String
    The provider-assigned unique ID for this managed resource.
    monitoredResourceTypes List<String>
    If present, then a time series, which is identified partially by a metric type and a MonitoredResourceDescriptor, that is associated with this metric type can only be associated with one of the monitored resource types listed here. This field allows time series to be associated with the intersection of this metric type and the monitored resource types in this list.
    name String
    The resource name of the metric descriptor.

    Look up Existing MetricDescriptor Resource

    Get an existing MetricDescriptor 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?: MetricDescriptorState, opts?: CustomResourceOptions): MetricDescriptor
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            description: Optional[str] = None,
            display_name: Optional[str] = None,
            labels: Optional[Sequence[MetricDescriptorLabelArgs]] = None,
            launch_stage: Optional[str] = None,
            metadata: Optional[MetricDescriptorMetadataArgs] = None,
            metric_kind: Optional[str] = None,
            monitored_resource_types: Optional[Sequence[str]] = None,
            name: Optional[str] = None,
            project: Optional[str] = None,
            type: Optional[str] = None,
            unit: Optional[str] = None,
            value_type: Optional[str] = None) -> MetricDescriptor
    func GetMetricDescriptor(ctx *Context, name string, id IDInput, state *MetricDescriptorState, opts ...ResourceOption) (*MetricDescriptor, error)
    public static MetricDescriptor Get(string name, Input<string> id, MetricDescriptorState? state, CustomResourceOptions? opts = null)
    public static MetricDescriptor get(String name, Output<String> id, MetricDescriptorState 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
    A detailed description of the metric, which can be used in documentation.
    DisplayName string
    A concise name for the metric, which can be displayed in user interfaces. Use sentence case without an ending period, for example "Request count".


    Labels List<MetricDescriptorLabel>
    The set of labels that can be used to describe a specific instance of this metric type. In order to delete a label, the entire resource must be deleted, then created with the desired labels. Structure is documented below.
    LaunchStage string
    The launch stage of the metric definition. Possible values are: LAUNCH_STAGE_UNSPECIFIED, UNIMPLEMENTED, PRELAUNCH, EARLY_ACCESS, ALPHA, BETA, GA, DEPRECATED.
    Metadata MetricDescriptorMetadata
    Metadata which can be used to guide usage of the metric. Structure is documented below.
    MetricKind string
    Whether the metric records instantaneous values, changes to a value, etc. Some combinations of metricKind and valueType might not be supported. Possible values are: METRIC_KIND_UNSPECIFIED, GAUGE, DELTA, CUMULATIVE.
    MonitoredResourceTypes List<string>
    If present, then a time series, which is identified partially by a metric type and a MonitoredResourceDescriptor, that is associated with this metric type can only be associated with one of the monitored resource types listed here. This field allows time series to be associated with the intersection of this metric type and the monitored resource types in this list.
    Name string
    The resource name of the metric descriptor.
    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    Type string
    The metric type, including its DNS name prefix. The type is not URL-encoded. All service defined metrics must be prefixed with the service name, in the format of {service name}/{relative metric name}, such as cloudsql.googleapis.com/database/cpu/utilization. The relative metric name must have only upper and lower-case letters, digits, '/' and underscores '_' are allowed. Additionally, the maximum number of characters allowed for the relative_metric_name is 100. All user-defined metric types have the DNS name custom.googleapis.com, external.googleapis.com, or logging.googleapis.com/user/.
    Unit string
    The units in which the metric value is reported. It is only applicable if the valueType is INT64, DOUBLE, or DISTRIBUTION. The unit defines the representation of the stored metric values. Different systems may scale the values to be more easily displayed (so a value of 0.02KBy might be displayed as 20By, and a value of 3523KBy might be displayed as 3.5MBy). However, if the unit is KBy, then the value of the metric is always in thousands of bytes, no matter how it may be displayed. If you want a custom metric to record the exact number of CPU-seconds used by a job, you can create an INT64 CUMULATIVE metric whose unit is s{CPU} (or equivalently 1s{CPU} or just s). If the job uses 12,005 CPU-seconds, then the value is written as 12005. Alternatively, if you want a custom metric to record data in a more granular way, you can create a DOUBLE CUMULATIVE metric whose unit is ks{CPU}, and then write the value 12.005 (which is 12005/1000), or use Kis{CPU} and write 11.723 (which is 12005/1024). The supported units are a subset of The Unified Code for Units of Measure standard. More info can be found in the API documentation (https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.metricDescriptors).
    ValueType string
    Whether the measurement is an integer, a floating-point number, etc. Some combinations of metricKind and valueType might not be supported. Possible values are: BOOL, INT64, DOUBLE, STRING, DISTRIBUTION.
    Description string
    A detailed description of the metric, which can be used in documentation.
    DisplayName string
    A concise name for the metric, which can be displayed in user interfaces. Use sentence case without an ending period, for example "Request count".


    Labels []MetricDescriptorLabelArgs
    The set of labels that can be used to describe a specific instance of this metric type. In order to delete a label, the entire resource must be deleted, then created with the desired labels. Structure is documented below.
    LaunchStage string
    The launch stage of the metric definition. Possible values are: LAUNCH_STAGE_UNSPECIFIED, UNIMPLEMENTED, PRELAUNCH, EARLY_ACCESS, ALPHA, BETA, GA, DEPRECATED.
    Metadata MetricDescriptorMetadataArgs
    Metadata which can be used to guide usage of the metric. Structure is documented below.
    MetricKind string
    Whether the metric records instantaneous values, changes to a value, etc. Some combinations of metricKind and valueType might not be supported. Possible values are: METRIC_KIND_UNSPECIFIED, GAUGE, DELTA, CUMULATIVE.
    MonitoredResourceTypes []string
    If present, then a time series, which is identified partially by a metric type and a MonitoredResourceDescriptor, that is associated with this metric type can only be associated with one of the monitored resource types listed here. This field allows time series to be associated with the intersection of this metric type and the monitored resource types in this list.
    Name string
    The resource name of the metric descriptor.
    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    Type string
    The metric type, including its DNS name prefix. The type is not URL-encoded. All service defined metrics must be prefixed with the service name, in the format of {service name}/{relative metric name}, such as cloudsql.googleapis.com/database/cpu/utilization. The relative metric name must have only upper and lower-case letters, digits, '/' and underscores '_' are allowed. Additionally, the maximum number of characters allowed for the relative_metric_name is 100. All user-defined metric types have the DNS name custom.googleapis.com, external.googleapis.com, or logging.googleapis.com/user/.
    Unit string
    The units in which the metric value is reported. It is only applicable if the valueType is INT64, DOUBLE, or DISTRIBUTION. The unit defines the representation of the stored metric values. Different systems may scale the values to be more easily displayed (so a value of 0.02KBy might be displayed as 20By, and a value of 3523KBy might be displayed as 3.5MBy). However, if the unit is KBy, then the value of the metric is always in thousands of bytes, no matter how it may be displayed. If you want a custom metric to record the exact number of CPU-seconds used by a job, you can create an INT64 CUMULATIVE metric whose unit is s{CPU} (or equivalently 1s{CPU} or just s). If the job uses 12,005 CPU-seconds, then the value is written as 12005. Alternatively, if you want a custom metric to record data in a more granular way, you can create a DOUBLE CUMULATIVE metric whose unit is ks{CPU}, and then write the value 12.005 (which is 12005/1000), or use Kis{CPU} and write 11.723 (which is 12005/1024). The supported units are a subset of The Unified Code for Units of Measure standard. More info can be found in the API documentation (https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.metricDescriptors).
    ValueType string
    Whether the measurement is an integer, a floating-point number, etc. Some combinations of metricKind and valueType might not be supported. Possible values are: BOOL, INT64, DOUBLE, STRING, DISTRIBUTION.
    description String
    A detailed description of the metric, which can be used in documentation.
    displayName String
    A concise name for the metric, which can be displayed in user interfaces. Use sentence case without an ending period, for example "Request count".


    labels List<MetricDescriptorLabel>
    The set of labels that can be used to describe a specific instance of this metric type. In order to delete a label, the entire resource must be deleted, then created with the desired labels. Structure is documented below.
    launchStage String
    The launch stage of the metric definition. Possible values are: LAUNCH_STAGE_UNSPECIFIED, UNIMPLEMENTED, PRELAUNCH, EARLY_ACCESS, ALPHA, BETA, GA, DEPRECATED.
    metadata MetricDescriptorMetadata
    Metadata which can be used to guide usage of the metric. Structure is documented below.
    metricKind String
    Whether the metric records instantaneous values, changes to a value, etc. Some combinations of metricKind and valueType might not be supported. Possible values are: METRIC_KIND_UNSPECIFIED, GAUGE, DELTA, CUMULATIVE.
    monitoredResourceTypes List<String>
    If present, then a time series, which is identified partially by a metric type and a MonitoredResourceDescriptor, that is associated with this metric type can only be associated with one of the monitored resource types listed here. This field allows time series to be associated with the intersection of this metric type and the monitored resource types in this list.
    name String
    The resource name of the metric descriptor.
    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    type String
    The metric type, including its DNS name prefix. The type is not URL-encoded. All service defined metrics must be prefixed with the service name, in the format of {service name}/{relative metric name}, such as cloudsql.googleapis.com/database/cpu/utilization. The relative metric name must have only upper and lower-case letters, digits, '/' and underscores '_' are allowed. Additionally, the maximum number of characters allowed for the relative_metric_name is 100. All user-defined metric types have the DNS name custom.googleapis.com, external.googleapis.com, or logging.googleapis.com/user/.
    unit String
    The units in which the metric value is reported. It is only applicable if the valueType is INT64, DOUBLE, or DISTRIBUTION. The unit defines the representation of the stored metric values. Different systems may scale the values to be more easily displayed (so a value of 0.02KBy might be displayed as 20By, and a value of 3523KBy might be displayed as 3.5MBy). However, if the unit is KBy, then the value of the metric is always in thousands of bytes, no matter how it may be displayed. If you want a custom metric to record the exact number of CPU-seconds used by a job, you can create an INT64 CUMULATIVE metric whose unit is s{CPU} (or equivalently 1s{CPU} or just s). If the job uses 12,005 CPU-seconds, then the value is written as 12005. Alternatively, if you want a custom metric to record data in a more granular way, you can create a DOUBLE CUMULATIVE metric whose unit is ks{CPU}, and then write the value 12.005 (which is 12005/1000), or use Kis{CPU} and write 11.723 (which is 12005/1024). The supported units are a subset of The Unified Code for Units of Measure standard. More info can be found in the API documentation (https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.metricDescriptors).
    valueType String
    Whether the measurement is an integer, a floating-point number, etc. Some combinations of metricKind and valueType might not be supported. Possible values are: BOOL, INT64, DOUBLE, STRING, DISTRIBUTION.
    description string
    A detailed description of the metric, which can be used in documentation.
    displayName string
    A concise name for the metric, which can be displayed in user interfaces. Use sentence case without an ending period, for example "Request count".


    labels MetricDescriptorLabel[]
    The set of labels that can be used to describe a specific instance of this metric type. In order to delete a label, the entire resource must be deleted, then created with the desired labels. Structure is documented below.
    launchStage string
    The launch stage of the metric definition. Possible values are: LAUNCH_STAGE_UNSPECIFIED, UNIMPLEMENTED, PRELAUNCH, EARLY_ACCESS, ALPHA, BETA, GA, DEPRECATED.
    metadata MetricDescriptorMetadata
    Metadata which can be used to guide usage of the metric. Structure is documented below.
    metricKind string
    Whether the metric records instantaneous values, changes to a value, etc. Some combinations of metricKind and valueType might not be supported. Possible values are: METRIC_KIND_UNSPECIFIED, GAUGE, DELTA, CUMULATIVE.
    monitoredResourceTypes string[]
    If present, then a time series, which is identified partially by a metric type and a MonitoredResourceDescriptor, that is associated with this metric type can only be associated with one of the monitored resource types listed here. This field allows time series to be associated with the intersection of this metric type and the monitored resource types in this list.
    name string
    The resource name of the metric descriptor.
    project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    type string
    The metric type, including its DNS name prefix. The type is not URL-encoded. All service defined metrics must be prefixed with the service name, in the format of {service name}/{relative metric name}, such as cloudsql.googleapis.com/database/cpu/utilization. The relative metric name must have only upper and lower-case letters, digits, '/' and underscores '_' are allowed. Additionally, the maximum number of characters allowed for the relative_metric_name is 100. All user-defined metric types have the DNS name custom.googleapis.com, external.googleapis.com, or logging.googleapis.com/user/.
    unit string
    The units in which the metric value is reported. It is only applicable if the valueType is INT64, DOUBLE, or DISTRIBUTION. The unit defines the representation of the stored metric values. Different systems may scale the values to be more easily displayed (so a value of 0.02KBy might be displayed as 20By, and a value of 3523KBy might be displayed as 3.5MBy). However, if the unit is KBy, then the value of the metric is always in thousands of bytes, no matter how it may be displayed. If you want a custom metric to record the exact number of CPU-seconds used by a job, you can create an INT64 CUMULATIVE metric whose unit is s{CPU} (or equivalently 1s{CPU} or just s). If the job uses 12,005 CPU-seconds, then the value is written as 12005. Alternatively, if you want a custom metric to record data in a more granular way, you can create a DOUBLE CUMULATIVE metric whose unit is ks{CPU}, and then write the value 12.005 (which is 12005/1000), or use Kis{CPU} and write 11.723 (which is 12005/1024). The supported units are a subset of The Unified Code for Units of Measure standard. More info can be found in the API documentation (https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.metricDescriptors).
    valueType string
    Whether the measurement is an integer, a floating-point number, etc. Some combinations of metricKind and valueType might not be supported. Possible values are: BOOL, INT64, DOUBLE, STRING, DISTRIBUTION.
    description str
    A detailed description of the metric, which can be used in documentation.
    display_name str
    A concise name for the metric, which can be displayed in user interfaces. Use sentence case without an ending period, for example "Request count".


    labels Sequence[MetricDescriptorLabelArgs]
    The set of labels that can be used to describe a specific instance of this metric type. In order to delete a label, the entire resource must be deleted, then created with the desired labels. Structure is documented below.
    launch_stage str
    The launch stage of the metric definition. Possible values are: LAUNCH_STAGE_UNSPECIFIED, UNIMPLEMENTED, PRELAUNCH, EARLY_ACCESS, ALPHA, BETA, GA, DEPRECATED.
    metadata MetricDescriptorMetadataArgs
    Metadata which can be used to guide usage of the metric. Structure is documented below.
    metric_kind str
    Whether the metric records instantaneous values, changes to a value, etc. Some combinations of metricKind and valueType might not be supported. Possible values are: METRIC_KIND_UNSPECIFIED, GAUGE, DELTA, CUMULATIVE.
    monitored_resource_types Sequence[str]
    If present, then a time series, which is identified partially by a metric type and a MonitoredResourceDescriptor, that is associated with this metric type can only be associated with one of the monitored resource types listed here. This field allows time series to be associated with the intersection of this metric type and the monitored resource types in this list.
    name str
    The resource name of the metric descriptor.
    project str
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    type str
    The metric type, including its DNS name prefix. The type is not URL-encoded. All service defined metrics must be prefixed with the service name, in the format of {service name}/{relative metric name}, such as cloudsql.googleapis.com/database/cpu/utilization. The relative metric name must have only upper and lower-case letters, digits, '/' and underscores '_' are allowed. Additionally, the maximum number of characters allowed for the relative_metric_name is 100. All user-defined metric types have the DNS name custom.googleapis.com, external.googleapis.com, or logging.googleapis.com/user/.
    unit str
    The units in which the metric value is reported. It is only applicable if the valueType is INT64, DOUBLE, or DISTRIBUTION. The unit defines the representation of the stored metric values. Different systems may scale the values to be more easily displayed (so a value of 0.02KBy might be displayed as 20By, and a value of 3523KBy might be displayed as 3.5MBy). However, if the unit is KBy, then the value of the metric is always in thousands of bytes, no matter how it may be displayed. If you want a custom metric to record the exact number of CPU-seconds used by a job, you can create an INT64 CUMULATIVE metric whose unit is s{CPU} (or equivalently 1s{CPU} or just s). If the job uses 12,005 CPU-seconds, then the value is written as 12005. Alternatively, if you want a custom metric to record data in a more granular way, you can create a DOUBLE CUMULATIVE metric whose unit is ks{CPU}, and then write the value 12.005 (which is 12005/1000), or use Kis{CPU} and write 11.723 (which is 12005/1024). The supported units are a subset of The Unified Code for Units of Measure standard. More info can be found in the API documentation (https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.metricDescriptors).
    value_type str
    Whether the measurement is an integer, a floating-point number, etc. Some combinations of metricKind and valueType might not be supported. Possible values are: BOOL, INT64, DOUBLE, STRING, DISTRIBUTION.
    description String
    A detailed description of the metric, which can be used in documentation.
    displayName String
    A concise name for the metric, which can be displayed in user interfaces. Use sentence case without an ending period, for example "Request count".


    labels List<Property Map>
    The set of labels that can be used to describe a specific instance of this metric type. In order to delete a label, the entire resource must be deleted, then created with the desired labels. Structure is documented below.
    launchStage String
    The launch stage of the metric definition. Possible values are: LAUNCH_STAGE_UNSPECIFIED, UNIMPLEMENTED, PRELAUNCH, EARLY_ACCESS, ALPHA, BETA, GA, DEPRECATED.
    metadata Property Map
    Metadata which can be used to guide usage of the metric. Structure is documented below.
    metricKind String
    Whether the metric records instantaneous values, changes to a value, etc. Some combinations of metricKind and valueType might not be supported. Possible values are: METRIC_KIND_UNSPECIFIED, GAUGE, DELTA, CUMULATIVE.
    monitoredResourceTypes List<String>
    If present, then a time series, which is identified partially by a metric type and a MonitoredResourceDescriptor, that is associated with this metric type can only be associated with one of the monitored resource types listed here. This field allows time series to be associated with the intersection of this metric type and the monitored resource types in this list.
    name String
    The resource name of the metric descriptor.
    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    type String
    The metric type, including its DNS name prefix. The type is not URL-encoded. All service defined metrics must be prefixed with the service name, in the format of {service name}/{relative metric name}, such as cloudsql.googleapis.com/database/cpu/utilization. The relative metric name must have only upper and lower-case letters, digits, '/' and underscores '_' are allowed. Additionally, the maximum number of characters allowed for the relative_metric_name is 100. All user-defined metric types have the DNS name custom.googleapis.com, external.googleapis.com, or logging.googleapis.com/user/.
    unit String
    The units in which the metric value is reported. It is only applicable if the valueType is INT64, DOUBLE, or DISTRIBUTION. The unit defines the representation of the stored metric values. Different systems may scale the values to be more easily displayed (so a value of 0.02KBy might be displayed as 20By, and a value of 3523KBy might be displayed as 3.5MBy). However, if the unit is KBy, then the value of the metric is always in thousands of bytes, no matter how it may be displayed. If you want a custom metric to record the exact number of CPU-seconds used by a job, you can create an INT64 CUMULATIVE metric whose unit is s{CPU} (or equivalently 1s{CPU} or just s). If the job uses 12,005 CPU-seconds, then the value is written as 12005. Alternatively, if you want a custom metric to record data in a more granular way, you can create a DOUBLE CUMULATIVE metric whose unit is ks{CPU}, and then write the value 12.005 (which is 12005/1000), or use Kis{CPU} and write 11.723 (which is 12005/1024). The supported units are a subset of The Unified Code for Units of Measure standard. More info can be found in the API documentation (https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.metricDescriptors).
    valueType String
    Whether the measurement is an integer, a floating-point number, etc. Some combinations of metricKind and valueType might not be supported. Possible values are: BOOL, INT64, DOUBLE, STRING, DISTRIBUTION.

    Supporting Types

    MetricDescriptorLabel, MetricDescriptorLabelArgs

    Key string
    The key for this label. The key must not exceed 100 characters. The first character of the key must be an upper- or lower-case letter, the remaining characters must be letters, digits or underscores, and the key must match the regular expression [a-zA-Z][a-zA-Z0-9_]*
    Description string
    A human-readable description for the label.
    ValueType string
    The type of data that can be assigned to the label. Default value is STRING. Possible values are: STRING, BOOL, INT64.
    Key string
    The key for this label. The key must not exceed 100 characters. The first character of the key must be an upper- or lower-case letter, the remaining characters must be letters, digits or underscores, and the key must match the regular expression [a-zA-Z][a-zA-Z0-9_]*
    Description string
    A human-readable description for the label.
    ValueType string
    The type of data that can be assigned to the label. Default value is STRING. Possible values are: STRING, BOOL, INT64.
    key String
    The key for this label. The key must not exceed 100 characters. The first character of the key must be an upper- or lower-case letter, the remaining characters must be letters, digits or underscores, and the key must match the regular expression [a-zA-Z][a-zA-Z0-9_]*
    description String
    A human-readable description for the label.
    valueType String
    The type of data that can be assigned to the label. Default value is STRING. Possible values are: STRING, BOOL, INT64.
    key string
    The key for this label. The key must not exceed 100 characters. The first character of the key must be an upper- or lower-case letter, the remaining characters must be letters, digits or underscores, and the key must match the regular expression [a-zA-Z][a-zA-Z0-9_]*
    description string
    A human-readable description for the label.
    valueType string
    The type of data that can be assigned to the label. Default value is STRING. Possible values are: STRING, BOOL, INT64.
    key str
    The key for this label. The key must not exceed 100 characters. The first character of the key must be an upper- or lower-case letter, the remaining characters must be letters, digits or underscores, and the key must match the regular expression [a-zA-Z][a-zA-Z0-9_]*
    description str
    A human-readable description for the label.
    value_type str
    The type of data that can be assigned to the label. Default value is STRING. Possible values are: STRING, BOOL, INT64.
    key String
    The key for this label. The key must not exceed 100 characters. The first character of the key must be an upper- or lower-case letter, the remaining characters must be letters, digits or underscores, and the key must match the regular expression [a-zA-Z][a-zA-Z0-9_]*
    description String
    A human-readable description for the label.
    valueType String
    The type of data that can be assigned to the label. Default value is STRING. Possible values are: STRING, BOOL, INT64.

    MetricDescriptorMetadata, MetricDescriptorMetadataArgs

    IngestDelay string
    The delay of data points caused by ingestion. Data points older than this age are guaranteed to be ingested and available to be read, excluding data loss due to errors. In [duration format](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf?&_ga=2.264881487.1507873253.1593446723-935052455.1591817775#google.protobuf.Duration).
    SamplePeriod string
    The sampling period of metric data points. For metrics which are written periodically, consecutive data points are stored at this time interval, excluding data loss due to errors. Metrics with a higher granularity have a smaller sampling period. In [duration format](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf?&_ga=2.264881487.1507873253.1593446723-935052455.1591817775#google.protobuf.Duration).
    IngestDelay string
    The delay of data points caused by ingestion. Data points older than this age are guaranteed to be ingested and available to be read, excluding data loss due to errors. In [duration format](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf?&_ga=2.264881487.1507873253.1593446723-935052455.1591817775#google.protobuf.Duration).
    SamplePeriod string
    The sampling period of metric data points. For metrics which are written periodically, consecutive data points are stored at this time interval, excluding data loss due to errors. Metrics with a higher granularity have a smaller sampling period. In [duration format](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf?&_ga=2.264881487.1507873253.1593446723-935052455.1591817775#google.protobuf.Duration).
    ingestDelay String
    The delay of data points caused by ingestion. Data points older than this age are guaranteed to be ingested and available to be read, excluding data loss due to errors. In [duration format](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf?&_ga=2.264881487.1507873253.1593446723-935052455.1591817775#google.protobuf.Duration).
    samplePeriod String
    The sampling period of metric data points. For metrics which are written periodically, consecutive data points are stored at this time interval, excluding data loss due to errors. Metrics with a higher granularity have a smaller sampling period. In [duration format](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf?&_ga=2.264881487.1507873253.1593446723-935052455.1591817775#google.protobuf.Duration).
    ingestDelay string
    The delay of data points caused by ingestion. Data points older than this age are guaranteed to be ingested and available to be read, excluding data loss due to errors. In [duration format](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf?&_ga=2.264881487.1507873253.1593446723-935052455.1591817775#google.protobuf.Duration).
    samplePeriod string
    The sampling period of metric data points. For metrics which are written periodically, consecutive data points are stored at this time interval, excluding data loss due to errors. Metrics with a higher granularity have a smaller sampling period. In [duration format](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf?&_ga=2.264881487.1507873253.1593446723-935052455.1591817775#google.protobuf.Duration).
    ingest_delay str
    The delay of data points caused by ingestion. Data points older than this age are guaranteed to be ingested and available to be read, excluding data loss due to errors. In [duration format](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf?&_ga=2.264881487.1507873253.1593446723-935052455.1591817775#google.protobuf.Duration).
    sample_period str
    The sampling period of metric data points. For metrics which are written periodically, consecutive data points are stored at this time interval, excluding data loss due to errors. Metrics with a higher granularity have a smaller sampling period. In [duration format](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf?&_ga=2.264881487.1507873253.1593446723-935052455.1591817775#google.protobuf.Duration).
    ingestDelay String
    The delay of data points caused by ingestion. Data points older than this age are guaranteed to be ingested and available to be read, excluding data loss due to errors. In [duration format](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf?&_ga=2.264881487.1507873253.1593446723-935052455.1591817775#google.protobuf.Duration).
    samplePeriod String
    The sampling period of metric data points. For metrics which are written periodically, consecutive data points are stored at this time interval, excluding data loss due to errors. Metrics with a higher granularity have a smaller sampling period. In [duration format](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf?&_ga=2.264881487.1507873253.1593446723-935052455.1591817775#google.protobuf.Duration).

    Import

    MetricDescriptor can be imported using any of these accepted formats:

    • {{name}}

    When using the pulumi import command, MetricDescriptor can be imported using one of the formats above. For example:

    $ pulumi import gcp:monitoring/metricDescriptor:MetricDescriptor default {{name}}
    

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

    Package Details

    Repository
    Google Cloud (GCP) Classic pulumi/pulumi-gcp
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the google-beta Terraform Provider.
    gcp logo
    Google Cloud Classic v7.19.0 published on Thursday, Apr 18, 2024 by Pulumi