Skip to content

Instantly share code, notes, and snippets.

Created October 8, 2018 22:17
What would you like to do?
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