Skip to content

Instantly share code, notes, and snippets.

@SirEdvin
Created May 28, 2018 19:20
Show Gist options
  • Save SirEdvin/c41461c82dd2b2c32e42a49df79293a2 to your computer and use it in GitHub Desktop.
Save SirEdvin/c41461c82dd2b2c32e42a49df79293a2 to your computer and use it in GitHub Desktop.
from sanic import Sanic
from sanic.response import json
from prometheus_client import Counter
from sanic_prometheus import monitor
c1 = Counter('simple_counter', "Just simple counter")
app = Sanic("snippet")
monitor(app).expose_endpoint()
@app.get('/')
async def test(response):
c1.inc()
return json({'message': "cute"})
if __name__ == '__main__':
app.run(host='127.0.0.1', port='8889', debug=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment