Metrics interface and Prometheus implementation (#1929)

* Metrics interface

* Prometheus implementation

* NoOp implementation

Co-authored-by: chris <chris@Profanity.local>
This commit is contained in:
Prawn
2020-08-18 19:27:50 +12:00
committed by GitHub
parent e1248f90f4
commit da4159513e
14 changed files with 577 additions and 1 deletions

18
metrics/options_test.go Normal file
View File

@@ -0,0 +1,18 @@
package metrics
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestOptions(t *testing.T) {
// Make some new options:
options := NewOptions(Path("/prometheus"), DefaultTags(map[string]string{"service": "prometheus-test"}))
// Check that the defaults and overrides were accepted:
assert.Equal(t, ":9000", options.Address)
assert.Equal(t, "/prometheus", options.Path)
assert.Equal(t, "prometheus-test", options.DefaultTags["service"])
}