Class: Google::Apis::LoggingV2::LogMetric

Inherits:
Object
  • Object
show all
Includes:
Core::Hashable, Core::JsonObjectSupport
Defined in:
generated/google/apis/logging_v2/classes.rb,
generated/google/apis/logging_v2/representations.rb,
generated/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.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Core::JsonObjectSupport

#to_json

Methods included from Core::Hashable

process_value, #to_h

Constructor Details

#initialize(**args) ⇒ LogMetric

Returns a new instance of LogMetric



987
988
989
# File 'generated/google/apis/logging_v2/classes.rb', line 987

def initialize(**args)
   update!(**args)
end

Instance Attribute Details

#descriptionString

Optional. A description of this metric, which is used in documentation. Corresponds to the JSON property description

Returns:

  • (String)


971
972
973
# File 'generated/google/apis/logging_v2/classes.rb', line 971

def description
  @description
end

#filterString

Required. An advanced logs filter 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

Returns:

  • (String)


985
986
987
# File 'generated/google/apis/logging_v2/classes.rb', line 985

def filter
  @filter
end

#nameString

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.The metric identifier in this field must not be URL-encoded (https://en.wikipedia.org/ wiki/Percent-encoding). However, when the metric identifier appears as the [ METRIC_ID] part of a metric_name API parameter, then the metric identifier must be URL-encoded. Example: "projects/my-project/metrics/nginx%2Frequests". Corresponds to the JSON property name

Returns:

  • (String)


966
967
968
# File 'generated/google/apis/logging_v2/classes.rb', line 966

def name
  @name
end

#versionString

Output only. The API version that created or updated this metric. The version also dictates the syntax of the filter expression. When a value for this field is missing, the default value of V2 should be assumed. Corresponds to the JSON property version

Returns:

  • (String)


978
979
980
# File 'generated/google/apis/logging_v2/classes.rb', line 978

def version
  @version
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



992
993
994
995
996
997
# File 'generated/google/apis/logging_v2/classes.rb', line 992

def update!(**args)
  @name = args[:name] if args.key?(:name)
  @description = args[:description] if args.key?(:description)
  @version = args[:version] if args.key?(:version)
  @filter = args[:filter] if args.key?(:filter)
end