Skip to content

Commit

Permalink
Add forwarding of maxDataPoints from requestContext to graphouse
Browse files Browse the repository at this point in the history
  • Loading branch information
Felixoid committed Aug 14, 2019
1 parent 0c2a1fa commit e674f22
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions src/main/pySources/graphouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,26 @@ def append(self, node):
'Maximum body size {} exceeded'.format(max_data_size)
)

def fetch(self, path, reqkey, start_time, end_time):
def fetch(self, path, reqkey, start_time, end_time, requestContext=None):
if path in self.result:
return self.result[path]

if reqkey is None:
reqkey = str(uuid.uuid4())
reqkey = reqkey or str(uuid.uuid4())

requestContext = requestContext or {}
maxDataPoints = requestContext.get('maxDataPoints')

profilingTime = {'start': time.time()}

try:
query = {
'start': start_time,
'end': end_time,
'reqKey': reqkey
}
'start': start_time,
'end': end_time,
'reqKey': reqkey,
}
if maxDataPoints:
query['maxDataPoints'] = maxDataPoints

data = {'metrics': ','.join(self.paths)}
request_url = graphouse_url + "/metricData"
request = requests.post(request_url, params=query, data=data)
Expand Down Expand Up @@ -248,7 +253,10 @@ def fetch(self, patterns, start_time, end_time, now=None,
}
"""

log.debug('Multifetcher, patterns={}'.format(patterns))
log.debug(
'Multifetcher, patterns={}, requestContext={}'
.format(patterns, requestContext)
)
profilingTime = {'start': time.time()}

requestContext = requestContext or {}
Expand Down Expand Up @@ -287,7 +295,7 @@ def fetch(self, patterns, start_time, end_time, now=None,
'Fetch values for reqkey={} for {} metrics'.format(
reqkey, len(sub.nodes)
),
sub.nodes[0].path, reqkey, start_time, end_time
sub.nodes[0].path, reqkey, start_time, end_time, requestContext
) for sub in subreqs if sub.nodes
]
profilingTime['gen_fetch'] = time.time()
Expand Down

0 comments on commit e674f22

Please sign in to comment.