Skip to content

Instantly share code, notes, and snippets.

@Jonnymcc
Created October 8, 2018 22:21
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/8151c0bf2252edf9c0f81917acf0fbc7 to your computer and use it in GitHub Desktop.
Save Jonnymcc/8151c0bf2252edf9c0f81917acf0fbc7 to your computer and use it in GitHub Desktop.
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