Class: Gcloud::Logging::Metric
- Inherits:
-
Object
- Object
- Gcloud::Logging::Metric
- Defined in:
- lib/gcloud/logging/metric.rb,
lib/gcloud/logging/metric/list.rb
Overview
# Metric
A logs-based [Google Cloud Monitoring](cloud.google.com/monitoring/docs) 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.
Defined Under Namespace
Classes: List
Instance Attribute Summary collapse
Class Method Summary collapse
Instance Method Summary collapse
-
#delete ⇒ Boolean
Permanently deletes the logs-based metric.
-
#description ⇒ Object
The description of this metric, which is used in documentation.
-
#description=(description) ⇒ Object
Updates the description of this metric, which is used in documentation.
-
#filter ⇒ Object
An [advanced logs filter](cloud.google.com/logging/docs/view/advanced_filters).
-
#filter=(filter) ⇒ Object
Updates the [advanced logs filter](cloud.google.com/logging/docs/view/advanced_filters).
-
#initialize ⇒ Metric
constructor
A new instance of Metric.
-
#name ⇒ Object
The client-assigned metric identifier.
-
#reload! ⇒ Object
(also: #refresh!)
Reloads the logs-based metric with current data from the Logging service.
-
#save ⇒ Object
Updates the logs-based metric.
Constructor Details
Instance Attribute Details
#grpc ⇒ Object
47 48 49 |
# File 'lib/gcloud/logging/metric.rb', line 47 def grpc @grpc end |
#service ⇒ Object
43 44 45 |
# File 'lib/gcloud/logging/metric.rb', line 43 def service @service end |
Class Method Details
.from_grpc(grpc, service) ⇒ Object
158 159 160 161 162 163 |
# File 'lib/gcloud/logging/metric.rb', line 158 def self.from_grpc grpc, service new.tap do |m| m.grpc = grpc m.service = service end end |
Instance Method Details
#delete ⇒ Boolean
Permanently deletes the logs-based metric.
148 149 150 151 152 153 154 |
# File 'lib/gcloud/logging/metric.rb', line 148 def delete ensure_service! service.delete_metric name return true rescue GRPC::BadStatus => e raise Gcloud::Error.from_error(e) end |
#description ⇒ Object
The description of this metric, which is used in documentation.
68 69 70 |
# File 'lib/gcloud/logging/metric.rb', line 68 def description grpc.description end |
#description=(description) ⇒ Object
Updates the description of this metric, which is used in documentation.
74 75 76 |
# File 'lib/gcloud/logging/metric.rb', line 74 def description= description grpc.description = description end |
#filter ⇒ Object
An [advanced logs filter](cloud.google.com/logging/docs/view/advanced_filters).
81 82 83 |
# File 'lib/gcloud/logging/metric.rb', line 81 def filter grpc.filter end |
#filter=(filter) ⇒ Object
Updates the [advanced logs filter](cloud.google.com/logging/docs/view/advanced_filters).
88 89 90 |
# File 'lib/gcloud/logging/metric.rb', line 88 def filter= filter grpc.filter = filter end |
#name ⇒ Object
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 `_-.,+!*’,()%/`. The forward-slash character (‘/`) denotes a hierarchy of name pieces, and it cannot be the first character of the name.
62 63 64 |
# File 'lib/gcloud/logging/metric.rb', line 62 def name grpc.name end |
#reload! ⇒ Object Also known as: refresh!
Reloads the logs-based metric with current data from the Logging service.
126 127 128 129 130 131 132 |
# File 'lib/gcloud/logging/metric.rb', line 126 def reload! ensure_service! @grpc = service.get_metric name return true rescue GRPC::BadStatus => e raise Gcloud::Error.from_error(e) end |
#save ⇒ Object
Updates the logs-based metric.
104 105 106 107 108 109 110 |
# File 'lib/gcloud/logging/metric.rb', line 104 def save ensure_service! @grpc = service.update_metric name, description, filter return true rescue GRPC::BadStatus => e raise Gcloud::Error.from_error(e) end |