Search code examples
pythonnginxuwsgigraphiteinfluxdb

Monitor web API response time in web server level


I was trying to measure some metrics (specially response times for different URLs) for my web app that is going to get under some user load. I chose InfluxDB as it can handle large amount of data and integerates nicely with Grafana (Graphite is also OK for me). I was going to post my reponse times from my flask app into InfluxDB using influxdb python client.

I wonder is there a tool or a simple way to fill InfluxDB from NGINX or uWSGI to get better performance and offload them from my python app?


Solution

  • If you want to feed performance data from your webserver into InfluxDB, there are several ways to do so. I would recommend you the following:

    1. Let your webserver log it's requests via syslog
    2. Use syslog-ng to process the logs
    3. syslog-ng can send the data to Graphite: Link
    4. InfluxDB has a graphite adapter built-in which can read the graphite protocoll and put the data into InfluxDB
    5. Use Grafana to display your InflxuDB data

    This is just an example toolchain. You can also use CollectD to gather your performance metrics and send it to InfluxDB's graphite adapter. But I think the syslog-ng solution is more elegant.