mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-23 05:57:19 +02:00
Add metrics implementation* Covers proxy service on server side* Update documentation
This commit is contained in:
parent
fb3ed64fa1
commit
ff528e8c7b
10 changed files with 310 additions and 1 deletions
27
internal/metrics/exporter_test.go
Normal file
27
internal/metrics/exporter_test.go
Normal file
|
@ -0,0 +1,27 @@
|
|||
package metrics
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io/ioutil"
|
||||
"net/http/httptest"
|
||||
"regexp"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func Test_newPromHTTPHandler(t *testing.T) {
|
||||
h := newPromHTTPHandler()
|
||||
|
||||
req := httptest.NewRequest("GET", "http://test.local/metrics", new(bytes.Buffer))
|
||||
rec := httptest.NewRecorder()
|
||||
h.ServeHTTP(rec, req)
|
||||
resp := rec.Result()
|
||||
b, _ := ioutil.ReadAll(resp.Body)
|
||||
|
||||
if resp == nil || resp.StatusCode != 200 {
|
||||
t.Errorf("Metrics endpoint failed to respond: %s", b)
|
||||
}
|
||||
|
||||
if m, _ := regexp.Match("^# HELP .*", b); !m {
|
||||
t.Errorf("Metrics endpoint did not contain any help messages: %s", b)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue