add Prometheus support

some basic counters and gauges are now exposed
This commit is contained in:
Nicola Murino
2019-09-13 18:45:36 +02:00
parent fd59f35108
commit 7eb5b01169
17 changed files with 377 additions and 20 deletions

View File

@@ -36,6 +36,7 @@ const (
activeConnectionsPath = "/api/v1/connection"
quotaScanPath = "/api/v1/quota_scan"
versionPath = "/api/v1/version"
metricsPath = "/metrics"
)
var (
@@ -710,6 +711,12 @@ func TestMethodNotAllowedMock(t *testing.T) {
checkResponseCode(t, http.StatusMethodNotAllowed, rr.Code)
}
func TestMetricsMock(t *testing.T) {
req, _ := http.NewRequest(http.MethodGet, metricsPath, nil)
rr := executeRequest(req)
checkResponseCode(t, http.StatusOK, rr.Code)
}
func waitTCPListening(address string) {
for {
conn, err := net.Dial("tcp", address)