Class Metric.Builder (3.8.0)

public static final class Metric.Builder extends MetricInfo.Builder

A builder for Metric objects.

Inheritance

java.lang.Object > MetricInfo.Builder > Metric.Builder

Methods

build()

public Metric build()

Creates a MetricInfo object for this builder.

Returns
TypeDescription
Metric
Overrides

setDescription(String description)

public Metric.Builder setDescription(String description)

Sets an optional description for this metric. Used for documentation purpose.

Parameter
NameDescription
descriptionString
Returns
TypeDescription
Metric.Builder
Overrides

setFilter(String filter)

public Metric.Builder setFilter(String filter)

Sets an advanced logs filter. The value of the metric is the number of log entries that match this filter. Example: logName=projects/my-projectid/logs/syslog AND severity>=ERROR.

Parameter
NameDescription
filterString
Returns
TypeDescription
Metric.Builder
Overrides

setName(String name)

public Metric.Builder setName(String name)

Sets the name of the metric. Example: severe-errors. Metric identifiers are limited to 1000 characters and can include only the following characters: A-Z, a-z, 0-9, and the special characters _-.,+!*',()%/</code>. The forward-slash character (/) denotes a hierarchy of name pieces, and it cannot be the first character of the name.

Parameter
NameDescription
nameString
Returns
TypeDescription
Metric.Builder
Overrides