Skip to content

Instantly share code, notes, and snippets.

@deniszh
Created October 25, 2021 19:23
Show Gist options
  • Save deniszh/559cdfa521fad4904bed67ab334216ff to your computer and use it in GitHub Desktop.
Save deniszh/559cdfa521fad4904bed67ab334216ff to your computer and use it in GitHub Desktop.
Patch for populating targets in graphite-web context
--- views.py.bak 2021-10-25 21:19:07.891661700 +0200
+++ views.py 2021-10-25 21:21:17.093932100 +0200
@@ -74,6 +74,8 @@
'xFilesFactor' : requestOptions['xFilesFactor'],
'maxDataPoints' : requestOptions.get('maxDataPoints', None),
'targets': requestOptions['targets'],
+ 'maxStep': requestOptions.get('maxStep', None),
+ 'targets_serialized': requestOptions.get('targets_serialized', None),
}
data = requestContext['data']
@@ -371,6 +373,9 @@
for target in mytargets:
requestOptions['targets'].append(target)
+ if requestOptions['targets']:
+ requestOptions['targets_serialized'] = pickle.dumps(requestOptions['targets'])
+
template = dict()
for key, val in queryParams.items():
if key.startswith("template["):
@@ -394,6 +399,8 @@
requestOptions['maxDataPoints'] = int(queryParams['maxDataPoints'])
if 'noNullPoints' in queryParams:
requestOptions['noNullPoints'] = True
+ if 'maxStep' in queryParams and queryParams['maxStep'].isdigit():
+ requestOptions['maxStep'] = int(queryParams['maxStep'])
requestOptions['localOnly'] = queryParams.get('local') == '1'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment