monitoring: check bounds of time series points
@@ -68,8 +68,10 @@ func readTimeSeriesAlign(w io.Writer, projectID string) error {
}
fmt.Fprintln(w, resp.GetMetric().GetLabels()["instance_name"])
fmt.Fprintf(w, "\tNow: %.4f\n", resp.GetPoints()[0].GetValue().GetDoubleValue())
+ if len(resp.GetPoints()) > 1 {
fmt.Fprintf(w, "\t10 minutes ago: %.4f\n", resp.GetPoints()[1].GetValue().GetDoubleValue())
}
+ }
fmt.Fprintln(w, "Done")
return nil
}
