tarantool / docbot

Bot to automate some GitHub things
4 stars 1 forks source link

Add grouping of metrics by endpoints #35

Closed ochaplashkin closed 1 year ago

ochaplashkin commented 1 year ago

Collecting metrics from each endpoint is a bad practice (if the service is on a public network, it can be attacked, scanned, etc).

Now the metrics will be grouped by handler functions and will not grow.

For example:

    @app.get('/')
    def index():
        ...

    @app.post('/')
    def webhook():
        ...

If you try to scan/hack (i.e. send a lot of requests), you will have only two metrics for the two paths:

flask_http_<...>{endpoint="index", method="GET", status="404"}
flask_http_<...>{endpoint="webhook", method="GET", status="404"}

instead of N metrics for the two paths, where N is count of requests:

flask_http_<...>{method="GET",path="/foo",status="404"}
flask_http_<...>{method="POST",path="/bar",status="404"}

Close #34