Skip to content

Instantly share code, notes, and snippets.

@Jonnymcc
Created October 8, 2018 22:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jonnymcc/e332e9145b750d4e1af64a93e4180225 to your computer and use it in GitHub Desktop.
Save Jonnymcc/e332e9145b750d4e1af64a93e4180225 to your computer and use it in GitHub Desktop.
Grafana simplejson datasource query endpoint
@app.route('/query', methods=['POST'])
def query():
req = request.get_json()
data = [
{
"target": req['targets'][0]['target'],
"datapoints": [
[861, convert_to_time_ms(req['range']['from'])],
[767, convert_to_time_ms(req['range']['to'])]
]
}
]
return jsonify(data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment