vechain / thor

A general purpose blockchain highly compatible with Ethereum's ecosystem
GNU Lesser General Public License v3.0
791 stars 247 forks source link

use middleware to capture HTTP server metrics #753

Closed libotony closed 1 month ago

libotony commented 1 month ago

Description

Using middleware to capture HTTP server metrics, added names for all paths, added feature that only records named path's metrics to avoid random API access potentially blowing up metrics db.

In this PR, dependency upgraded github.com/gorilla/mux v1.6.0 -> v1.8.1

Checklist:

codecov-commenter commented 1 month ago

Codecov Report

Attention: Patch coverage is 75.00000% with 19 lines in your changes are missing coverage. Please review.

Project coverage is 62.58%. Comparing base (b18c7a6) to head (2cf99b2). Report is 1 commits behind head on master.

Files Patch % Lines
cmd/thor/main.go 0.00% 14 Missing :warning:
api/api.go 0.00% 5 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #753 +/- ## ========================================== + Coverage 62.55% 62.58% +0.03% ========================================== Files 198 199 +1 Lines 18071 18093 +22 ========================================== + Hits 11304 11324 +20 - Misses 5683 5687 +4 + Partials 1084 1082 -2 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

libotony commented 1 month ago

@otherview @leszek-vechain Unit test added, covering both 200 and none-200 cases and also no named urls(metrics)