Class: Google::Apis::LoggingV2::LogMetric
- Inherits:
-
Object
- Object
- Google::Apis::LoggingV2::LogMetric
- Includes:
- Core::Hashable, Core::JsonObjectSupport
- Defined in:
- lib/google/apis/logging_v2/classes.rb,
lib/google/apis/logging_v2/representations.rb,
lib/google/apis/logging_v2/representations.rb
Overview
Describes a logs-based metric. The value of the metric is the number of log entries that match a logs filter in a given time interval.Logs-based metrics can also be used to extract values from logs and create 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.
Instance Attribute Summary collapse
-
#bucket_name ⇒ String
Optional.
-
#bucket_options ⇒ Google::Apis::LoggingV2::BucketOptions
BucketOptions describes the bucket boundaries used to create a histogram for the distribution.
-
#create_time ⇒ String
Output only.
-
#description ⇒ String
Optional.
-
#disabled ⇒ Boolean
(also: #disabled?)
Optional.
-
#filter ⇒ String
Required.
-
#label_extractors ⇒ Hash<String,String>
Optional.
-
#metric_descriptor ⇒ Google::Apis::LoggingV2::MetricDescriptor
Defines a metric type and its schema.
-
#name ⇒ String
Required.
-
#resource_name ⇒ String
Output only.
-
#update_time ⇒ String
Output only.
-
#value_extractor ⇒ String
Optional.
-
#version ⇒ String
Deprecated.
Instance Method Summary collapse
-
#initialize(**args) ⇒ LogMetric
constructor
A new instance of LogMetric.
-
#update!(**args) ⇒ Object
Update properties of this object.
Constructor Details
#initialize(**args) ⇒ LogMetric
Returns a new instance of LogMetric.
2709 2710 2711 |
# File 'lib/google/apis/logging_v2/classes.rb', line 2709 def initialize(**args) update!(**args) end |
Instance Attribute Details
#bucket_name ⇒ String
Optional. 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.For example:projects/my-project/locations/global/buckets/
my-bucketIf empty, then the Log Metric is considered a non-Bucket Log Metric.
Corresponds to the JSON property bucketName
2594 2595 2596 |
# File 'lib/google/apis/logging_v2/classes.rb', line 2594 def bucket_name @bucket_name end |
#bucket_options ⇒ Google::Apis::LoggingV2::BucketOptions
BucketOptions describes the bucket boundaries used to create a histogram for
the distribution. The buckets can be in a linear sequence, an exponential
sequence, or each bucket can be specified explicitly. BucketOptions does not
include the number of values in each bucket.A bucket has an inclusive lower
bound and exclusive upper bound for the values that are counted for that
bucket. The upper bound of a bucket must be strictly greater than the lower
bound. The sequence of N buckets for a distribution consists of an underflow
bucket (number 0), zero or more finite buckets (number 1 through N - 2) and an
overflow bucket (number N - 1). The buckets are contiguous: the lower bound of
bucket i (i > 0) is the same as the upper bound of bucket i - 1. The buckets
span the whole range of finite values: lower bound of the underflow bucket is -
infinity and the upper bound of the overflow bucket is +infinity. The finite
buckets are so-called because both bounds are finite.
Corresponds to the JSON property bucketOptions
2611 2612 2613 |
# File 'lib/google/apis/logging_v2/classes.rb', line 2611 def @bucket_options end |
#create_time ⇒ String
Output only. The creation timestamp of the metric.This field may not be
present for older metrics.
Corresponds to the JSON property createTime
2617 2618 2619 |
# File 'lib/google/apis/logging_v2/classes.rb', line 2617 def create_time @create_time end |
#description ⇒ String
Optional. A description of this metric, which is used in documentation. The
maximum length of the description is 8000 characters.
Corresponds to the JSON property description
2623 2624 2625 |
# File 'lib/google/apis/logging_v2/classes.rb', line 2623 def description @description end |
#disabled ⇒ Boolean Also known as: disabled?
Optional. If set to True, then this metric is disabled and it does not
generate any points.
Corresponds to the JSON property disabled
2629 2630 2631 |
# File 'lib/google/apis/logging_v2/classes.rb', line 2629 def disabled @disabled end |
#filter ⇒ String
Required. An advanced logs filter (https://cloud.google.com/logging/docs/view/
advanced_filters) which is used to match log entries. Example: "resource.type=
gae_app AND severity>=ERROR" The maximum length of the filter is 20000
characters.
Corresponds to the JSON property filter
2638 2639 2640 |
# File 'lib/google/apis/logging_v2/classes.rb', line 2638 def filter @filter end |
#label_extractors ⇒ Hash<String,String>
Optional. 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 value_extractor field.The extracted value is converted to
the type defined in the label descriptor. If either the extraction or the type
conversion fails, the label will have a default value. The default value for a
string label is an empty string, for an integer label its 0, and for a boolean
label its false.Note that there are upper bounds on the maximum number of
labels and the number of active time series that are allowed in a project.
Corresponds to the JSON property labelExtractors
2652 2653 2654 |
# File 'lib/google/apis/logging_v2/classes.rb', line 2652 def label_extractors @label_extractors end |
#metric_descriptor ⇒ Google::Apis::LoggingV2::MetricDescriptor
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.
Corresponds to the JSON property metricDescriptor
2659 2660 2661 |
# File 'lib/google/apis/logging_v2/classes.rb', line 2659 def metric_descriptor @metric_descriptor end |
#name ⇒ String
Required. The client-assigned metric identifier. Examples: "error_count", "
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.This field is
the [METRIC_ID] part of a metric resource name in the format "projects/
PROJECT_ID/metrics/METRIC_ID". Example: If the resource name of a metric is "
projects/my-project/metrics/nginx%2Frequests", this field's value is "nginx/
requests".
Corresponds to the JSON property name
2672 2673 2674 |
# File 'lib/google/apis/logging_v2/classes.rb', line 2672 def name @name end |
#resource_name ⇒ String
Output only. The resource name of the metric: "projects/[PROJECT_ID]/metrics/[
METRIC_ID]"
Corresponds to the JSON property resourceName
2678 2679 2680 |
# File 'lib/google/apis/logging_v2/classes.rb', line 2678 def resource_name @resource_name end |
#update_time ⇒ String
Output only. The last update timestamp of the metric.This field may not be
present for older metrics.
Corresponds to the JSON property updateTime
2684 2685 2686 |
# File 'lib/google/apis/logging_v2/classes.rb', line 2684 def update_time @update_time end |
#value_extractor ⇒ String
Optional. A value_extractor 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 arguments are: field: The name of the log entry field from which the
value is to be extracted. 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.The result of the
extraction must be convertible to a double type, as the distribution always
records double values. If either the extraction or the conversion to double
fails, then those values are not recorded in the distribution.Example:
REGEXP_EXTRACT(jsonPayload.request, ".quantity=(\d+).")
Corresponds to the JSON property valueExtractor
2701 2702 2703 |
# File 'lib/google/apis/logging_v2/classes.rb', line 2701 def value_extractor @value_extractor end |
#version ⇒ String
Deprecated. The API version that created or updated this metric. The v2 format
is used by default and cannot be changed.
Corresponds to the JSON property version
2707 2708 2709 |
# File 'lib/google/apis/logging_v2/classes.rb', line 2707 def version @version end |
Instance Method Details
#update!(**args) ⇒ Object
Update properties of this object
2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 |
# File 'lib/google/apis/logging_v2/classes.rb', line 2714 def update!(**args) @bucket_name = args[:bucket_name] if args.key?(:bucket_name) @bucket_options = args[:bucket_options] if args.key?(:bucket_options) @create_time = args[:create_time] if args.key?(:create_time) @description = args[:description] if args.key?(:description) @disabled = args[:disabled] if args.key?(:disabled) @filter = args[:filter] if args.key?(:filter) @label_extractors = args[:label_extractors] if args.key?(:label_extractors) @metric_descriptor = args[:metric_descriptor] if args.key?(:metric_descriptor) @name = args[:name] if args.key?(:name) @resource_name = args[:resource_name] if args.key?(:resource_name) @update_time = args[:update_time] if args.key?(:update_time) @value_extractor = args[:value_extractor] if args.key?(:value_extractor) @version = args[:version] if args.key?(:version) end |