Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions scripts/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@


class AbstractQueryGenerator(AbstractGenerator):
one_day = (1000 * 60 * 60 * 24)
one_minute = (1000 * 60)
one_day = (one_minute * 60 * 24)

query_interval_name = None

Expand Down Expand Up @@ -106,7 +107,9 @@ def make_request(self, logger, time, tenant_id=None):
if tenant_id is None:
tenant_id = self.user.get_tenant_id()
to = time
frm = time - self.one_day
# Unlike time series data, annotations don't have any kind of rollup, so querying for a day's data can return a
# huge payload, causing memory issues on the servers when you generate a lot of load.
frm = time - self.one_minute
url = "%s/v2.0/%s/events/getEvents?from=%d&until=%d" % (
self.config['query_url'], tenant_id, frm, to)
result = self.request.GET(url)
Expand Down
2 changes: 1 addition & 1 deletion scripts/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ def test_query_make_AnnotationsQuery_request(self):
response = qq.make_request(None, 1000, 30)
self.assertEqual(req.get_url,
"http://metrics.example.org/v2.0/30/events/" +
"getEvents?from=-86399000&until=1000")
"getEvents?from=-59000&until=1000")
self.assertIs(req, response.request)


Expand Down