如何以5分钟的间隔获取stackdriver时间序列数据?

时间:2018-06-15 05:47:42

标签: ruby ruby-on-rails-5 stackdriver google-cloud-monitoring

我正在使用ruby gem google-cloud-monitoring

我在几秒钟内创建了这个google protobuf时间戳的对象。

Google::Protobuf::Timestamp.new(seconds: Time.now.beginning_of_day.utc.to_i)

然后我创建了一个客户端

Google::Cloud::Monitoring::V3::MetricServiceClient

然后我在此客户端上调用了list_time_series方法并传递了Google::Monitoring::V3::TimeInterval

对象的间隔

然后作为回应我得到的时间序列是一个哈希数组,其中包含一个键points,每30秒计数一次。

我的问题是如何以5分钟的间隔获取此数据。

响应结构,每30秒钟,我需要在5分钟内获得这些数据。

{:time_series=>
  [{:metric=>{
    :points=>
     [{:interval=>
        {:start_time=>{:seconds=>1528964901},
         :end_time=>{:seconds=>1528964901}},
       :value=>
        {#otherdata}},
      {:interval=>
        {:start_time=>{:seconds=>1528964871},
         :end_time=>{:seconds=>1528964871}},
       :value=>
        {#other data}}
      ]}  
    }
  ]
}

我按照这个链接 list_time_seriesgem google-cloud-monitoring

0 个答案:

没有答案
相关问题