Created
May 11, 2017 16:46
-
-
Save thagomizer/d34cc4d375578f4b8f2c8d8b4de7eb38 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "google/cloud/monitoring/v3/metric_service_client" | |
client = Google::Cloud::Monitoring::V3::MetricServiceClient.new | |
project = Google::Cloud::Monitoring::V3::MetricServiceClient.project_path(PROJECT_ID) | |
metric = "appengine.googleapis.com/system/memory/usage" | |
end_time = Time.now.to_i | |
start_time = end_time - (60 * 10) # 10 minutes | |
filter = "metric.type = \"#{metric}\"" | |
interval = Google::Monitoring::V3::TimeInterval.new | |
interval.start_time = Google::Protobuf::Timestamp.new(seconds: start_time) | |
interval.end_time = Google::Protobuf::Timestamp.new(seconds: end_time) | |
view = Google::Monitoring::V3::ListTimeSeriesRequest::TimeSeriesView::FULL | |
time_series = client.list_time_series(project, filter, interval, view) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment