Skip to content

TimeSeries Query for last 5 Minutes not Last 5 Minutes #2459

Closed
@waprin

Description

@waprin

The usage docs say

query = client.query(METRIC, minutes=5)

will give you stats for the last five minutes. But since the code replaces seconds and microseconds with 0, it's not actually the last 5 minutes since you won't be querying any time interval between the end of the previous minute and the current second.

The reason this came up is in the system tests, I write a point, then try to query it back, but I never get the time series even if they are there, since I

write_point: 2016-09-28T19:29:57.726637
query end_time: 2016-09-28T19:29:00.000000Z

so even though write_point happened first, it's end_time is after the end_time of the query.

Maybe people think second granularity doesn't matter? I'm curious why replacing the second/microseconds with 0 was done in the first place. I think at a minimum the docs are slightly misleading, since it's not the last 5 minutes in the colloquial sense (doesn't include the seconds up until now in the current minute).

cc @rimey @supriyagarg

Metadata

Metadata

Assignees

Labels

api: monitoringIssues related to the Cloud Monitoring API.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions