You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Python prides itself for English like/expressive syntax. Currently using Java-esque epoch time for start and end time range in query_metric(..., start=<start_timestamp>, end=<end_timestamp>) seems to a bit awkward to work with (at least in 2.7). I have to add the following code to get metrics within the last 5 minutes.
def unix_time_millis(dt):
return '{:.0f}'.format((dt - epoch).total_seconds() * 1000)
...
now = datetime.utcnow()
end = unix_time_millis(now)
start = unix_time_millis(now - timedelta(minutes=5))
data = client.query_metric(MetricType.Counter, metric_id, start=start, end=end)
It would be nice if query_metric() can support native Python datetime, time, timedelta.
The text was updated successfully, but these errors were encountered:
Python prides itself for English like/expressive syntax. Currently using Java-esque epoch time for start and end time range in
query_metric(..., start=<start_timestamp>, end=<end_timestamp>)
seems to a bit awkward to work with (at least in 2.7). I have to add the following code to get metrics within the last 5 minutes.It would be nice if
query_metric()
can support native Python datetime, time, timedelta.The text was updated successfully, but these errors were encountered: