Package com.google.cloud.logging
Class Metric.Builder
- java.lang.Object
-
- com.google.cloud.logging.MetricInfo.Builder
-
- com.google.cloud.logging.Metric.Builder
-
- Enclosing class:
- Metric
public static final class Metric.Builder extends MetricInfo.Builder
A builder forMetric
objects.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Metric
build()
Creates aMetricInfo
object for this builder.Metric.Builder
setDescription(String description)
Sets an optional description for this metric.Metric.Builder
setFilter(String filter)
Sets an advanced logs filter.Metric.Builder
setName(String name)
Sets the name of the metric.
-
-
-
Method Detail
-
setName
@CanIgnoreReturnValue public Metric.Builder setName(String name)
Description copied from class:MetricInfo.Builder
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_-.,+!*',()%/\
. The forward-slash character (/
) denotes a hierarchy of name pieces, and it cannot be the first character of the name.- Specified by:
setName
in classMetricInfo.Builder
-
setDescription
@CanIgnoreReturnValue public Metric.Builder setDescription(String description)
Description copied from class:MetricInfo.Builder
Sets an optional description for this metric. Used for documentation purpose.- Specified by:
setDescription
in classMetricInfo.Builder
-
setFilter
@CanIgnoreReturnValue public Metric.Builder setFilter(String filter)
Description copied from class:MetricInfo.Builder
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
.- Specified by:
setFilter
in classMetricInfo.Builder
- See Also:
- Advanced Log Filters
-
build
public Metric build()
Description copied from class:MetricInfo.Builder
Creates aMetricInfo
object for this builder.- Specified by:
build
in classMetricInfo.Builder
-
-