Skip to content

Instantly share code, notes, and snippets.

@Jonnymcc
Created October 8, 2018 22:28
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/cc61d41b49af4eb8177f7354a0d24441 to your computer and use it in GitHub Desktop.
Save Jonnymcc/cc61d41b49af4eb8177f7354a0d24441 to your computer and use it in GitHub Desktop.
Grafana simplejson datasource tag-values endpoint
@app.route('/tag-values', methods=['POST'])
def tag_values():
req = request.get_json()
if req['key'] == 'City':
return jsonify([
{'text': 'Tokyo'},
{'text': 'São Paulo'},
{'text': 'Jakarta'}
])
elif req['key'] == 'Country':
return jsonify([
{'text': 'China'},
{'text': 'India'},
{'text': 'United States'}
])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment