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
{{ message }}
This repository was archived by the owner on May 11, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on May 11, 2026. It is now read-only.
feature request: query_metric(start/end params) to support native Python datetime #43
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.
Activity
Allow use of datetime or timedelta where approriate, fixes hawkular#43
Merge pull request #44 from burmanm/feature/43