Metric class
Logs-based metric can also be used to extract values from logs and create a a distribution of the values. The distribution records the statistics of the extracted values along with an optional histogram of the values as specified by the bucket options.
To get more information about Metric, see:
- API documentation
- How-to Guides
- Official Documentation
Example Usage
Logging Metric Basic
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const loggingMetric = new gcp.logging.Metric("logging_metric", {
name: "my-(custom)/metric",
filter: "resource.type=gae_app AND severity>=ERROR",
metricDescriptor: {
metricKind: "DELTA",
valueType: "DISTRIBUTION",
unit: "1",
labels: [
{
key: "mass",
valueType: "STRING",
description: "amount of matter",
},
{
key: "sku",
valueType: "INT64",
description: "Identifying number for item",
},
],
displayName: "My metric",
},
valueExtractor: "EXTRACT(jsonPayload.request)",
labelExtractors: {
mass: "EXTRACT(jsonPayload.request)",
sku: "EXTRACT(jsonPayload.id)",
},
bucketOptions: {
linearBuckets: {
numFiniteBuckets: 3,
width: 1,
offset: 1,
},
},
});
import pulumi
import pulumi_gcp as gcp
logging_metric = gcp.logging.Metric("logging_metric",
name="my-(custom)/metric",
filter="resource.type=gae_app AND severity>=ERROR",
metric_descriptor={
"metric_kind": "DELTA",
"value_type": "DISTRIBUTION",
"unit": "1",
"labels": [
{
"key": "mass",
"value_type": "STRING",
"description": "amount of matter",
},
{
"key": "sku",
"value_type": "INT64",
"description": "Identifying number for item",
},
],
"display_name": "My metric",
},
value_extractor="EXTRACT(jsonPayload.request)",
label_extractors={
"mass": "EXTRACT(jsonPayload.request)",
"sku": "EXTRACT(jsonPayload.id)",
},
bucket_options={
"linear_buckets": {
"num_finite_buckets": 3,
"width": float(1),
"offset": float(1),
},
})
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var loggingMetric = new Gcp.Logging.Metric("logging_metric", new()
{
Name = "my-(custom)/metric",
Filter = "resource.type=gae_app AND severity>=ERROR",
MetricDescriptor = new Gcp.Logging.Inputs.MetricMetricDescriptorArgs
{
MetricKind = "DELTA",
ValueType = "DISTRIBUTION",
Unit = "1",
Labels = new[]
{
new Gcp.Logging.Inputs.MetricMetricDescriptorLabelArgs
{
Key = "mass",
ValueType = "STRING",
Description = "amount of matter",
},
new Gcp.Logging.Inputs.MetricMetricDescriptorLabelArgs
{
Key = "sku",
ValueType = "INT64",
Description = "Identifying number for item",
},
},
DisplayName = "My metric",
},
ValueExtractor = "EXTRACT(jsonPayload.request)",
LabelExtractors =
{
{ "mass", "EXTRACT(jsonPayload.request)" },
{ "sku", "EXTRACT(jsonPayload.id)" },
},
BucketOptions = new Gcp.Logging.Inputs.MetricBucketOptionsArgs
{
LinearBuckets = new Gcp.Logging.Inputs.MetricBucketOptionsLinearBucketsArgs
{
NumFiniteBuckets = 3,
Width = 1.0,
Offset = 1.0,
},
},
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/logging"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := logging.NewMetric(ctx, "logging_metric", &logging.MetricArgs{
Name: pulumi.String("my-(custom)/metric"),
Filter: pulumi.String("resource.type=gae_app AND severity>=ERROR"),
MetricDescriptor: &logging.MetricMetricDescriptorArgs{
MetricKind: pulumi.String("DELTA"),
ValueType: pulumi.String("DISTRIBUTION"),
Unit: pulumi.String("1"),
Labels: logging.MetricMetricDescriptorLabelArray{
&logging.MetricMetricDescriptorLabelArgs{
Key: pulumi.String("mass"),
ValueType: pulumi.String("STRING"),
Description: pulumi.String("amount of matter"),
},
&logging.MetricMetricDescriptorLabelArgs{
Key: pulumi.String("sku"),
ValueType: pulumi.String("INT64"),
Description: pulumi.String("Identifying number for item"),
},
},
DisplayName: pulumi.String("My metric"),
},
ValueExtractor: pulumi.String("EXTRACT(jsonPayload.request)"),
LabelExtractors: pulumi.StringMap{
"mass": pulumi.String("EXTRACT(jsonPayload.request)"),
"sku": pulumi.String("EXTRACT(jsonPayload.id)"),
},
BucketOptions: &logging.MetricBucketOptionsArgs{
LinearBuckets: &logging.MetricBucketOptionsLinearBucketsArgs{
NumFiniteBuckets: pulumi.Int(3),
Width: pulumi.Float64(1),
Offset: pulumi.Float64(1),
},
},
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
gcp = {
source = "pulumi/gcp"
}
}
}
resource "gcp_logging_metric" "logging_metric" {
name = "my-(custom)/metric"
filter = "resource.type=gae_app AND severity>=ERROR"
metric_descriptor = {
metric_kind = "DELTA"
value_type = "DISTRIBUTION"
unit = "1"
labels = [{
"key" = "mass"
"valueType" = "STRING"
"description" = "amount of matter"
}, {
"key" = "sku"
"valueType" = "INT64"
"description" = "Identifying number for item"
}]
display_name = "My metric"
}
value_extractor = "EXTRACT(jsonPayload.request)"
label_extractors = {
"mass" = "EXTRACT(jsonPayload.request)"
"sku" = "EXTRACT(jsonPayload.id)"
}
bucket_options = {
linear_buckets = {
num_finite_buckets = 3
width = 1
offset = 1
}
}
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.logging.Metric;
import com.pulumi.gcp.logging.MetricArgs;
import com.pulumi.gcp.logging.inputs.MetricMetricDescriptorArgs;
import com.pulumi.gcp.logging.inputs.MetricMetricDescriptorLabelArgs;
import com.pulumi.gcp.logging.inputs.MetricBucketOptionsArgs;
import com.pulumi.gcp.logging.inputs.MetricBucketOptionsLinearBucketsArgs;
import java.util.ArrayList;
import java.util.Arrays;
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 loggingMetric = new Metric("loggingMetric", MetricArgs.builder()
.name("my-(custom)/metric")
.filter("resource.type=gae_app AND severity>=ERROR")
.metricDescriptor(MetricMetricDescriptorArgs.builder()
.metricKind("DELTA")
.valueType("DISTRIBUTION")
.unit("1")
.labels(
MetricMetricDescriptorLabelArgs.builder()
.key("mass")
.valueType("STRING")
.description("amount of matter")
.build(),
MetricMetricDescriptorLabelArgs.builder()
.key("sku")
.valueType("INT64")
.description("Identifying number for item")
.build())
.displayName("My metric")
.build())
.valueExtractor("EXTRACT(jsonPayload.request)")
.labelExtractors(Map.ofEntries(
Map.entry("mass", "EXTRACT(jsonPayload.request)"),
Map.entry("sku", "EXTRACT(jsonPayload.id)")
))
.bucketOptions(MetricBucketOptionsArgs.builder()
.linearBuckets(MetricBucketOptionsLinearBucketsArgs.builder()
.numFiniteBuckets(3)
.width(1.0)
.offset(1.0)
.build())
.build())
.build());
}
}
resources:
loggingMetric:
type: gcp:logging:Metric
name: logging_metric
properties:
name: my-(custom)/metric
filter: resource.type=gae_app AND severity>=ERROR
metricDescriptor:
metricKind: DELTA
valueType: DISTRIBUTION
unit: '1'
labels:
- key: mass
valueType: STRING
description: amount of matter
- key: sku
valueType: INT64
description: Identifying number for item
displayName: My metric
valueExtractor: EXTRACT(jsonPayload.request)
labelExtractors:
mass: EXTRACT(jsonPayload.request)
sku: EXTRACT(jsonPayload.id)
bucketOptions:
linearBuckets:
numFiniteBuckets: 3
width: 1
offset: 1
Logging Metric Counter Basic
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const loggingMetric = new gcp.logging.Metric("logging_metric", {
name: "my-(custom)/metric",
filter: "resource.type=gae_app AND severity>=ERROR",
metricDescriptor: {
metricKind: "DELTA",
valueType: "INT64",
},
});
import pulumi
import pulumi_gcp as gcp
logging_metric = gcp.logging.Metric("logging_metric",
name="my-(custom)/metric",
filter="resource.type=gae_app AND severity>=ERROR",
metric_descriptor={
"metric_kind": "DELTA",
"value_type": "INT64",
})
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var loggingMetric = new Gcp.Logging.Metric("logging_metric", new()
{
Name = "my-(custom)/metric",
Filter = "resource.type=gae_app AND severity>=ERROR",
MetricDescriptor = new Gcp.Logging.Inputs.MetricMetricDescriptorArgs
{
MetricKind = "DELTA",
ValueType = "INT64",
},
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/logging"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := logging.NewMetric(ctx, "logging_metric", &logging.MetricArgs{
Name: pulumi.String("my-(custom)/metric"),
Filter: pulumi.String("resource.type=gae_app AND severity>=ERROR"),
MetricDescriptor: &logging.MetricMetricDescriptorArgs{
MetricKind: pulumi.String("DELTA"),
ValueType: pulumi.String("INT64"),
},
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
gcp = {
source = "pulumi/gcp"
}
}
}
resource "gcp_logging_metric" "logging_metric" {
name = "my-(custom)/metric"
filter = "resource.type=gae_app AND severity>=ERROR"
metric_descriptor = {
metric_kind = "DELTA"
value_type = "INT64"
}
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.logging.Metric;
import com.pulumi.gcp.logging.MetricArgs;
import com.pulumi.gcp.logging.inputs.MetricMetricDescriptorArgs;
import java.util.ArrayList;
import java.util.Arrays;
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 loggingMetric = new Metric("loggingMetric", MetricArgs.builder()
.name("my-(custom)/metric")
.filter("resource.type=gae_app AND severity>=ERROR")
.metricDescriptor(MetricMetricDescriptorArgs.builder()
.metricKind("DELTA")
.valueType("INT64")
.build())
.build());
}
}
resources:
loggingMetric:
type: gcp:logging:Metric
name: logging_metric
properties:
name: my-(custom)/metric
filter: resource.type=gae_app AND severity>=ERROR
metricDescriptor:
metricKind: DELTA
valueType: INT64
Logging Metric Counter Labels
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const loggingMetric = new gcp.logging.Metric("logging_metric", {
name: "my-(custom)/metric",
filter: "resource.type=gae_app AND severity>=ERROR",
metricDescriptor: {
metricKind: "DELTA",
valueType: "INT64",
labels: [{
key: "mass",
valueType: "STRING",
description: "amount of matter",
}],
},
labelExtractors: {
mass: "EXTRACT(jsonPayload.request)",
},
});
import pulumi
import pulumi_gcp as gcp
logging_metric = gcp.logging.Metric("logging_metric",
name="my-(custom)/metric",
filter="resource.type=gae_app AND severity>=ERROR",
metric_descriptor={
"metric_kind": "DELTA",
"value_type": "INT64",
"labels": [{
"key": "mass",
"value_type": "STRING",
"description": "amount of matter",
}],
},
label_extractors={
"mass": "EXTRACT(jsonPayload.request)",
})
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var loggingMetric = new Gcp.Logging.Metric("logging_metric", new()
{
Name = "my-(custom)/metric",
Filter = "resource.type=gae_app AND severity>=ERROR",
MetricDescriptor = new Gcp.Logging.Inputs.MetricMetricDescriptorArgs
{
MetricKind = "DELTA",
ValueType = "INT64",
Labels = new[]
{
new Gcp.Logging.Inputs.MetricMetricDescriptorLabelArgs
{
Key = "mass",
ValueType = "STRING",
Description = "amount of matter",
},
},
},
LabelExtractors =
{
{ "mass", "EXTRACT(jsonPayload.request)" },
},
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/logging"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := logging.NewMetric(ctx, "logging_metric", &logging.MetricArgs{
Name: pulumi.String("my-(custom)/metric"),
Filter: pulumi.String("resource.type=gae_app AND severity>=ERROR"),
MetricDescriptor: &logging.MetricMetricDescriptorArgs{
MetricKind: pulumi.String("DELTA"),
ValueType: pulumi.String("INT64"),
Labels: logging.MetricMetricDescriptorLabelArray{
&logging.MetricMetricDescriptorLabelArgs{
Key: pulumi.String("mass"),
ValueType: pulumi.String("STRING"),
Description: pulumi.String("amount of matter"),
},
},
},
LabelExtractors: pulumi.StringMap{
"mass": pulumi.String("EXTRACT(jsonPayload.request)"),
},
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
gcp = {
source = "pulumi/gcp"
}
}
}
resource "gcp_logging_metric" "logging_metric" {
name = "my-(custom)/metric"
filter = "resource.type=gae_app AND severity>=ERROR"
metric_descriptor = {
metric_kind = "DELTA"
value_type = "INT64"
labels = [{
"key" = "mass"
"valueType" = "STRING"
"description" = "amount of matter"
}]
}
label_extractors = {
"mass" = "EXTRACT(jsonPayload.request)"
}
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.logging.Metric;
import com.pulumi.gcp.logging.MetricArgs;
import com.pulumi.gcp.logging.inputs.MetricMetricDescriptorArgs;
import com.pulumi.gcp.logging.inputs.MetricMetricDescriptorLabelArgs;
import java.util.ArrayList;
import java.util.Arrays;
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 loggingMetric = new Metric("loggingMetric", MetricArgs.builder()
.name("my-(custom)/metric")
.filter("resource.type=gae_app AND severity>=ERROR")
.metricDescriptor(MetricMetricDescriptorArgs.builder()
.metricKind("DELTA")
.valueType("INT64")
.labels(MetricMetricDescriptorLabelArgs.builder()
.key("mass")
.valueType("STRING")
.description("amount of matter")
.build())
.build())
.labelExtractors(Map.of("mass", "EXTRACT(jsonPayload.request)"))
.build());
}
}
resources:
loggingMetric:
type: gcp:logging:Metric
name: logging_metric
properties:
name: my-(custom)/metric
filter: resource.type=gae_app AND severity>=ERROR
metricDescriptor:
metricKind: DELTA
valueType: INT64
labels:
- key: mass
valueType: STRING
description: amount of matter
labelExtractors:
mass: EXTRACT(jsonPayload.request)
Logging Metric Logging Bucket
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const loggingMetric = new gcp.logging.ProjectBucketConfig("logging_metric", {
location: "global",
project: "my-project-name",
bucketId: "_Default",
});
const loggingMetricMetric = new gcp.logging.Metric("logging_metric", {
name: "my-(custom)/metric",
filter: "resource.type=gae_app AND severity>=ERROR",
bucketName: loggingMetric.name,
});
import pulumi
import pulumi_gcp as gcp
logging_metric = gcp.logging.ProjectBucketConfig("logging_metric",
location="global",
project="my-project-name",
bucket_id="_Default")
logging_metric_metric = gcp.logging.Metric("logging_metric",
name="my-(custom)/metric",
filter="resource.type=gae_app AND severity>=ERROR",
bucket_name=logging_metric.name)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var loggingMetric = new Gcp.Logging.ProjectBucketConfig("logging_metric", new()
{
Location = "global",
Project = "my-project-name",
BucketId = "_Default",
});
var loggingMetricMetric = new Gcp.Logging.Metric("logging_metric", new()
{
Name = "my-(custom)/metric",
Filter = "resource.type=gae_app AND severity>=ERROR",
BucketName = loggingMetric.Name,
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/logging"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
loggingMetric, err := logging.NewProjectBucketConfig(ctx, "logging_metric", &logging.ProjectBucketConfigArgs{
Location: pulumi.String("global"),
Project: pulumi.String("my-project-name"),
BucketId: pulumi.String("_Default"),
})
if err != nil {
return err
}
_, err = logging.NewMetric(ctx, "logging_metric", &logging.MetricArgs{
Name: pulumi.String("my-(custom)/metric"),
Filter: pulumi.String("resource.type=gae_app AND severity>=ERROR"),
BucketName: loggingMetric.Name,
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
gcp = {
source = "pulumi/gcp"
}
}
}
resource "gcp_logging_projectbucketconfig" "logging_metric" {
location = "global"
project = "my-project-name"
bucket_id = "_Default"
}
resource "gcp_logging_metric" "logging_metric" {
name = "my-(custom)/metric"
filter = "resource.type=gae_app AND severity>=ERROR"
bucket_name = gcp_logging_projectbucketconfig.logging_metric.name
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.logging.ProjectBucketConfig;
import com.pulumi.gcp.logging.ProjectBucketConfigArgs;
import com.pulumi.gcp.logging.Metric;
import com.pulumi.gcp.logging.MetricArgs;
import java.util.ArrayList;
import java.util.Arrays;
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 loggingMetric = new ProjectBucketConfig("loggingMetric", ProjectBucketConfigArgs.builder()
.location("global")
.project("my-project-name")
.bucketId("_Default")
.build());
var loggingMetricMetric = new Metric("loggingMetricMetric", MetricArgs.builder()
.name("my-(custom)/metric")
.filter("resource.type=gae_app AND severity>=ERROR")
.bucketName(loggingMetric.name())
.build());
}
}
resources:
loggingMetric:
type: gcp:logging:ProjectBucketConfig
name: logging_metric
properties:
location: global
project: my-project-name
bucketId: _Default
loggingMetricMetric:
type: gcp:logging:Metric
name: logging_metric
properties:
name: my-(custom)/metric
filter: resource.type=gae_app AND severity>=ERROR
bucketName: ${loggingMetric.name}
Logging Metric Disabled
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const loggingMetric = new gcp.logging.Metric("logging_metric", {
name: "my-(custom)/metric",
filter: "resource.type=gae_app AND severity>=ERROR",
metricDescriptor: {
metricKind: "DELTA",
valueType: "INT64",
},
disabled: true,
});
import pulumi
import pulumi_gcp as gcp
logging_metric = gcp.logging.Metric("logging_metric",
name="my-(custom)/metric",
filter="resource.type=gae_app AND severity>=ERROR",
metric_descriptor={
"metric_kind": "DELTA",
"value_type": "INT64",
},
disabled=True)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var loggingMetric = new Gcp.Logging.Metric("logging_metric", new()
{
Name = "my-(custom)/metric",
Filter = "resource.type=gae_app AND severity>=ERROR",
MetricDescriptor = new Gcp.Logging.Inputs.MetricMetricDescriptorArgs
{
MetricKind = "DELTA",
ValueType = "INT64",
},
Disabled = true,
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/logging"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := logging.NewMetric(ctx, "logging_metric", &logging.MetricArgs{
Name: pulumi.String("my-(custom)/metric"),
Filter: pulumi.String("resource.type=gae_app AND severity>=ERROR"),
MetricDescriptor: &logging.MetricMetricDescriptorArgs{
MetricKind: pulumi.String("DELTA"),
ValueType: pulumi.String("INT64"),
},
Disabled: pulumi.Bool(true),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
gcp = {
source = "pulumi/gcp"
}
}
}
resource "gcp_logging_metric" "logging_metric" {
name = "my-(custom)/metric"
filter = "resource.type=gae_app AND severity>=ERROR"
metric_descriptor = {
metric_kind = "DELTA"
value_type = "INT64"
}
disabled = true
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.logging.Metric;
import com.pulumi.gcp.logging.MetricArgs;
import com.pulumi.gcp.logging.inputs.MetricMetricDescriptorArgs;
import java.util.ArrayList;
import java.util.Arrays;
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 loggingMetric = new Metric("loggingMetric", MetricArgs.builder()
.name("my-(custom)/metric")
.filter("resource.type=gae_app AND severity>=ERROR")
.metricDescriptor(MetricMetricDescriptorArgs.builder()
.metricKind("DELTA")
.valueType("INT64")
.build())
.disabled(true)
.build());
}
}
resources:
loggingMetric:
type: gcp:logging:Metric
name: logging_metric
properties:
name: my-(custom)/metric
filter: resource.type=gae_app AND severity>=ERROR
metricDescriptor:
metricKind: DELTA
valueType: INT64
disabled: true
Import
Metric can be imported using any of these accepted formats:
{{project}} {{name}}{{name}}
When using the pulumi import command, Metric can be imported using one of the formats above. For example:
$ terraform import google_logging_metric.default "{{project}} {{name}}"
$ pulumi import gcp:logging/metric:Metric default {{name}}
Constructors
- Metric(String name, {MetricArgs? args, CustomResourceOptions? options})
-
Creates a new Metric.
nameThe Pulumi resource name.argsArguments used to configure this Metric. The set of arguments for Metric.optionsResource options controlling this resource's behavior. - Metric.reference(String urn)
- Creates a typed reference to an existing Metric resource.
Properties
-
bucketName
↔ Output<
String?> -
The resource name of the Log Bucket that owns the Log Metric. Only Log Buckets in projects
are supported. The bucket has to be in the same project as the metric.
latefinal
-
bucketOptions
↔ Output<
MetricBucketOptions?> -
The bucketOptions are required when the logs-based metric is using a DISTRIBUTION value type and it
describes the bucket boundaries used to create a histogram of the extracted values.
Structure is documented below.
latefinal
-
childResources
→ Set<
Resource> -
finalinherited
-
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
-
deletionPolicy
↔ Output<
String> -
Whether Terraform will be prevented from destroying the resource. Defaults to DELETE.
When a 'terraform destroy' or 'pulumi up' would delete the resource,
the command will fail if this field is set to "PREVENT" in Terraform state.
When set to "ABANDON", the command will remove the resource from Terraform
management without updating or deleting the resource in the API.
When set to "DELETE", deleting the resource is allowed.
latefinal
-
description
↔ Output<
String?> -
A description of this metric, which is used in documentation. The maximum length of the
description is 8000 characters.
latefinal
-
disabled
↔ Output<
bool?> -
If set to True, then this metric is disabled and it does not generate any points.
latefinal
-
filter
↔ Output<
String> -
An advanced logs filter (https://cloud.google.com/logging/docs/view/advanced-filters) which
is used to match log entries.
latefinal
- hashCode → int
-
The hash code for this object.
no setterinherited
-
id
↔ Output<
String> -
getter/setter pairinherited
- isCustom → bool
-
Returns whether this resource is provider-managed.
no setterinherited
- isProtected → bool
-
Returns whether this resource is protected from deletion.
no setterinherited
- isRemote → bool
-
Whether this resource is registered as remote.
no setterinherited
- isResourceReference → bool
-
Whether this instance represents a resource value returned over RPC.
finalinherited
-
labelExtractors
↔ Output<
Map< String, String> ?> -
A map from a label key string to an extractor expression which is used to extract data from a log
entry field and assign as the label value. Each label key specified in the LabelDescriptor must
have an associated extractor expression in this map. The syntax of the extractor expression is
the same as for the valueExtractor field.
latefinal
-
metricDescriptor
↔ Output<
MetricMetricDescriptor> -
The optional metric descriptor associated with the logs-based metric.
If unspecified, it uses a default metric descriptor with a DELTA metric kind,
INT64 value type, with no labels and a unit of "1". Such a metric counts the
number of log entries matching the filter expression.
Structure is documented below.
latefinal
-
name
↔ Output<
String> -
The client-assigned metric identifier. Examples - "errorCount", "nginx/requests".
Metric identifiers are limited to 100 characters and can include only the following
characters A-Z, a-z, 0-9, and the special characters _-.,+!*',()%/. The forward-slash
character (/) denotes a hierarchy of name pieces, and it cannot be the first character
of the name.
latefinal
-
project
↔ Output<
String> -
The ID of the project in which the resource belongs.
If it is not provided, the provider project is used.
latefinal
-
resourceTransforms
→ List<
ResourceTransform> -
Inherited/explicit async transforms.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
urn
↔ Output<
String> -
latefinalinherited
-
valueExtractor
↔ Output<
String?> -
A valueExtractor is required when using a distribution logs-based metric to extract the values to
record from a log entry. Two functions are supported for value extraction - EXTRACT(field) or
REGEXP_EXTRACT(field, regex). The argument are 1. field - The name of the log entry field from which
the value is to be extracted. 2. regex - A regular expression using the Google RE2 syntax
(https://github.com/google/re2/wiki/Syntax) with a single capture group to extract data from the specified
log entry field. The value of the field is converted to a string before applying the regex. It is an
error to specify a regex that does not include exactly one capture group.
latefinal
Methods
-
failId(
Object error) → void -
Completes this resource ID with an error when registration fails.
inherited
-
failOutputs(
Object error) → void -
Completes all output properties with
error.inherited -
failUrn(
Object error) → void -
Completes this resource URN with an error when registration fails.
inherited
-
getProvider(
String moduleMember) → ProviderResource? -
Returns provider for
moduleMember's package, if configured.inherited -
getResourceName(
) → String -
Returns this resource's logical name.
inherited
-
getResourceType(
) → String -
Returns this resource's Pulumi type token.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerOutput<
T> (String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output< T> -
Registers a dynamic output property for this resource.
inherited
-
resolveId(
String? value, {required bool isKnown}) → void -
Resolves the provider-assigned ID for this resource.
inherited
-
resolveOutputs(
Struct outputs) → void -
Resolves all output properties from a monitor response payload.
inherited
-
resolveUrn(
String value) → void -
Resolves this resource's URN once assigned by the engine.
inherited
-
serializeProperties(
Map< String, dynamic> properties) → Future<Struct> -
Serializes resource properties for RPC transmission.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited