Reference documentation and code samples for the Cloud Logging API class Google::Cloud::Logging::Metric.
Metric
A logs-based Google Cloud Monitoring metric. A metric is a measured value that can be used to assess a system. The basis of a logs-based metric is the collection of log entries that match a logs filter.
Inherits
- Object
Example
require "google/cloud/logging" logging = Google::Cloud::Logging.new metric = logging.create_metric "errors", "severity>=ERROR"
Methods
#delete
def delete() -> BooleanPermanently deletes the logs-based metric.
-
(Boolean) — Returns
trueif the metric was deleted.
require "google/cloud/logging" logging = Google::Cloud::Logging.new metric = logging.metric "severe_errors" metric.delete
#description
def description()The description of this metric, which is used in documentation.
#description=
def description=(description)Updates the description of this metric, which is used in documentation.
#filter
def filter()#filter=
def filter=(filter)Updates the advanced logs filter.
#name
def name()The client-assigned metric identifier. 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.
#refresh!
def refresh!()Reloads the logs-based metric with current data from the Logging service.
require "google/cloud/logging" logging = Google::Cloud::Logging.new metric = logging.metric "severe_errors" metric.filter = "Unwanted value" metric.reload! metric.filter #=> "logName:syslog"
#reload!
def reload!()Reloads the logs-based metric with current data from the Logging service.
require "google/cloud/logging" logging = Google::Cloud::Logging.new metric = logging.metric "severe_errors" metric.filter = "Unwanted value" metric.reload! metric.filter #=> "logName:syslog"
#save
def save()Updates the logs-based metric.
require "google/cloud/logging" logging = Google::Cloud::Logging.new metric = logging.metric "severe_errors" metric.filter = "logName:syslog AND severity>=ERROR" metric.save