metrology icon indicating copy to clipboard operation
metrology copied to clipboard

Provide integration with WSGI or Flask

Open diyan opened this issue 10 years ago • 1 comments

Hello again,

I'm developing Flask extension that collects some metrics from the Flask app.

Flask extension that collects metrics using Metrology and push them to Graphite - https://gist.github.com/diyan/8829149

It's supposed to have some meaningful defaults which could be changes in app settings.

Right now code is alpha quality and works only for my use-cases but I've decided to share it on an early phase.

Would be glad to get any feedback on this (negative is fine).

Also I'm considering split this code into two pieses (but not entirely sure that it's a good idea):

  • Flask extension with functionality tied to Flask framework and some other Flask extensions that I'm using now
  • Generic WSGI middleware with very few meters/counters

This extension sends following metrics to Graphite:

metrology.<hostname>.<process_name>.flask.http_code_2xx.one_minute_rate
metrology.<hostname>.<process_name>.flask.http_code_3xx.one_minute_rate
metrology.<hostname>.<process_name>.flask.http_code_4xx.one_minute_rate
metrology.<hostname>.<process_name>.flask.http_code_5xx.one_minute_rate
metrology.<hostname>.<process_name>.flask.endpoins.<module_name>__<function_name>.one_minute_rate
metrology.<hostname>.<process_name>.flask.endpoins.<module_name>__<function_name>.percentile_95th
metrology.<hostname>.<process_name>.flask.endpoins.<module_name>__<function_name>.count

Known issues:

  • Only singletone process is supported now (multiple workers under Gunicorn/uWSGI/Circus will screw numbers)

diyan avatar Feb 05 '14 17:02 diyan

Love the idea, but would prefer if it wasn't tied to a framework, so I like the WSGI middleware even better!

cyberdelia avatar Mar 23 '14 01:03 cyberdelia