Skip to content

Instantly share code, notes, and snippets.

@Jonnymcc

Jonnymcc/index.py

Created Oct 8, 2018
Embed
What would you like to do?
Grafana simplejson datasource annotations endpoint
@app.route('/annotations', methods=['POST'])
def annotations():
req = request.get_json()
data = [
{
"annotation": 'This is the annotation',
"time": (convert_to_time_ms(req['range']['from']) +
convert_to_time_ms(req['range']['to'])) / 2,
"title": 'Deployment notes',
"tags": ['tag1', 'tag2'],
"text": 'Hm, something went wrong...'
}
]
return jsonify(data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment