Skip to content

Instantly share code, notes, and snippets.

@deniszh
Created October 16, 2021 13:28
Show Gist options
  • Save deniszh/c655e3b3fcd810b0b980708c62a02e92 to your computer and use it in GitHub Desktop.
Save deniszh/c655e3b3fcd810b0b980708c62a02e92 to your computer and use it in GitHub Desktop.
Patch for populating targets in graphite-web context
--- /opt/graphite/webapp/graphite/render/views.py.bak 2021-10-07 19:04:25.052907254 +0000
+++ /opt/graphite/webapp/graphite/render/views.py 2021-10-13 20:11:51.136487024 +0000
@@ -73,6 +73,8 @@
'prefetched' : {},
'xFilesFactor' : requestOptions['xFilesFactor'],
'maxDataPoints' : requestOptions.get('maxDataPoints', None),
+ 'maxStep': requestOptions.get('maxStep', None),
+ 'targets_serialized': requestOptions.get('targets_serialized', None),
}
data = requestContext['data']
@@ -370,6 +372,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["):
@@ -393,6 +398,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