numberly / flask-graphite

:chart_with_upwards_trend: Push useful metrics for each request without effort!
https://flask-graphite.readthedocs.io
MIT License
16 stars 1 forks source link

Metrics a levels deeper #13

Open Mohamed-0-Hassan opened 5 years ago

Mohamed-0-Hassan commented 5 years ago

@app.route('/person'): # measure total call and duration some validation check database call # measure total call and duration

i do some validation checks and then execute a database call. Is it also possible to have a tree that shows the pt and count of the database call

ramnes commented 5 years ago

Hi @Mohamed-0-Hassan!

We don't implement anything for this in Flask-Graphite so far, but the library on which it is based, graphitesend, might help you here.

That being said, I would love that we make it possible. An easy way would be to have a decorator that you could apply on any kind of function to have more insights. Something around those lines:

from flask_graphite import send_metrics
...

@send_metrics
def call_database(...):
    ...

@app.route('/person')
def get_person(...):
    ...
    call_database(...)
    ...

Feel free to make a PR if you feel like you could achieve this!

ping @Shir0kamii

Shir0kamii commented 5 years ago

Hi!

This is planned for graphitesender (replacement for graphitesend). It'll come in the following weeks.

Then we could just proxy those features in flask_graphite.