Merge pull request #533 from prometheus/beorn7/vendoring
Re-adjust to the old float formatting in prometheus/common
This commit is contained in:
commit
fc06704084
11
go.mod
11
go.mod
|
@ -3,10 +3,9 @@ module github.com/prometheus/client_golang
|
||||||
require (
|
require (
|
||||||
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973
|
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973
|
||||||
github.com/golang/protobuf v1.2.0
|
github.com/golang/protobuf v1.2.0
|
||||||
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
|
github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f
|
||||||
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910
|
github.com/prometheus/common v0.2.0
|
||||||
github.com/prometheus/common v0.0.0-20181218105931-67670fe90761
|
github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1
|
||||||
github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a
|
golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3
|
||||||
golang.org/x/net v0.0.0-20181217023233-e147a9138326
|
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 // indirect
|
||||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f // indirect
|
|
||||||
)
|
)
|
||||||
|
|
41
go.sum
41
go.sum
|
@ -1,16 +1,45 @@
|
||||||
|
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||||
|
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||||
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 h1:xJ4a3vCFaGF/jqvzLMYoU8P317H5OQ+Via4RmuPwCS0=
|
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 h1:xJ4a3vCFaGF/jqvzLMYoU8P317H5OQ+Via4RmuPwCS0=
|
||||||
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
||||||
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||||
|
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
|
||||||
|
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||||
|
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
||||||
github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
|
github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
|
||||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
|
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
|
||||||
|
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||||
|
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
||||||
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
|
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
|
||||||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||||
|
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
||||||
|
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
|
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
|
||||||
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910 h1:idejC8f05m9MGOsuEi1ATq9shN03HrxNkD/luQvxCv8=
|
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910 h1:idejC8f05m9MGOsuEi1ATq9shN03HrxNkD/luQvxCv8=
|
||||||
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
|
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
|
||||||
github.com/prometheus/common v0.0.0-20181218105931-67670fe90761 h1:z6tvbDJ5OLJ48FFmnksv04a78maSTRBUIhkdHYV5Y98=
|
github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f h1:BVwpUVJDADN2ufcGik7W992pyps0wZ888b/y9GXcLTU=
|
||||||
github.com/prometheus/common v0.0.0-20181218105931-67670fe90761/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
|
github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
|
||||||
github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a h1:9a8MnZMP0X2nLJdBg+pBmGgkJlSaKC2KaQmTCk1XDtE=
|
github.com/prometheus/common v0.2.0 h1:kUZDBDTdBVBYBj5Tmh2NZLlF60mfjA27rM34b+cVwNU=
|
||||||
github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
|
||||||
golang.org/x/net v0.0.0-20181217023233-e147a9138326 h1:iCzOf0xz39Tstp+Tu/WwyGjUXCk34QhQORRxBeXXTA4=
|
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
||||||
golang.org/x/net v0.0.0-20181217023233-e147a9138326/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1 h1:/K3IL0Z1quvmJ7X0A1AwNEK7CRkVK3YwfOU/QAL4WGg=
|
||||||
|
github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
||||||
|
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||||
|
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
|
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||||
|
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||||
|
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3 h1:ulvT7fqt0yHWzpJwI57MezWnYDVpCAYBVuYst/L+fAY=
|
||||||
|
golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f h1:Bl/8QSvNqXvPGPGXa2z5xUTmV7VDcZyvRZ+QQXkXTZQ=
|
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f h1:Bl/8QSvNqXvPGPGXa2z5xUTmV7VDcZyvRZ+QQXkXTZQ=
|
||||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw=
|
||||||
|
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||||
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
|
|
@ -109,11 +109,11 @@ error collecting metric Desc{fqName: "invalid_metric", help: "not helpful", cons
|
||||||
`
|
`
|
||||||
wantOKBody := `# HELP name docstring
|
wantOKBody := `# HELP name docstring
|
||||||
# TYPE name counter
|
# TYPE name counter
|
||||||
name{constname="constvalue",labelname="val1"} 1.0
|
name{constname="constvalue",labelname="val1"} 1
|
||||||
name{constname="constvalue",labelname="val2"} 1.0
|
name{constname="constvalue",labelname="val2"} 1
|
||||||
# HELP the_count Ah-ah-ah! Thunder and lightning!
|
# HELP the_count Ah-ah-ah! Thunder and lightning!
|
||||||
# TYPE the_count counter
|
# TYPE the_count counter
|
||||||
the_count 0.0
|
the_count 0
|
||||||
`
|
`
|
||||||
|
|
||||||
errorHandler.ServeHTTP(writer, request)
|
errorHandler.ServeHTTP(writer, request)
|
||||||
|
@ -163,11 +163,11 @@ func TestInstrumentMetricHandler(t *testing.T) {
|
||||||
t.Errorf("got HTTP status code %d, want %d", got, want)
|
t.Errorf("got HTTP status code %d, want %d", got, want)
|
||||||
}
|
}
|
||||||
|
|
||||||
want := "promhttp_metric_handler_requests_in_flight 1.0\n"
|
want := "promhttp_metric_handler_requests_in_flight 1\n"
|
||||||
if got := writer.Body.String(); !strings.Contains(got, want) {
|
if got := writer.Body.String(); !strings.Contains(got, want) {
|
||||||
t.Errorf("got body %q, does not contain %q", got, want)
|
t.Errorf("got body %q, does not contain %q", got, want)
|
||||||
}
|
}
|
||||||
want = "promhttp_metric_handler_requests_total{code=\"200\"} 0.0\n"
|
want = "promhttp_metric_handler_requests_total{code=\"200\"} 0\n"
|
||||||
if got := writer.Body.String(); !strings.Contains(got, want) {
|
if got := writer.Body.String(); !strings.Contains(got, want) {
|
||||||
t.Errorf("got body %q, does not contain %q", got, want)
|
t.Errorf("got body %q, does not contain %q", got, want)
|
||||||
}
|
}
|
||||||
|
@ -178,11 +178,11 @@ func TestInstrumentMetricHandler(t *testing.T) {
|
||||||
t.Errorf("got HTTP status code %d, want %d", got, want)
|
t.Errorf("got HTTP status code %d, want %d", got, want)
|
||||||
}
|
}
|
||||||
|
|
||||||
want = "promhttp_metric_handler_requests_in_flight 1.0\n"
|
want = "promhttp_metric_handler_requests_in_flight 1\n"
|
||||||
if got := writer.Body.String(); !strings.Contains(got, want) {
|
if got := writer.Body.String(); !strings.Contains(got, want) {
|
||||||
t.Errorf("got body %q, does not contain %q", got, want)
|
t.Errorf("got body %q, does not contain %q", got, want)
|
||||||
}
|
}
|
||||||
want = "promhttp_metric_handler_requests_total{code=\"200\"} 1.0\n"
|
want = "promhttp_metric_handler_requests_total{code=\"200\"} 1\n"
|
||||||
if got := writer.Body.String(); !strings.Contains(got, want) {
|
if got := writer.Body.String(); !strings.Contains(got, want) {
|
||||||
t.Errorf("got body %q, does not contain %q", got, want)
|
t.Errorf("got body %q, does not contain %q", got, want)
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,7 +99,7 @@ func testHandler(t testing.TB) {
|
||||||
externalMetricFamilyAsBytes := externalBuf.Bytes()
|
externalMetricFamilyAsBytes := externalBuf.Bytes()
|
||||||
externalMetricFamilyAsText := []byte(`# HELP externalname externaldocstring
|
externalMetricFamilyAsText := []byte(`# HELP externalname externaldocstring
|
||||||
# TYPE externalname counter
|
# TYPE externalname counter
|
||||||
externalname{externalconstname="externalconstvalue",externallabelname="externalval1"} 1.0
|
externalname{externalconstname="externalconstvalue",externallabelname="externalval1"} 1
|
||||||
`)
|
`)
|
||||||
externalMetricFamilyAsProtoText := []byte(`name: "externalname"
|
externalMetricFamilyAsProtoText := []byte(`name: "externalname"
|
||||||
help: "externaldocstring"
|
help: "externaldocstring"
|
||||||
|
@ -167,8 +167,8 @@ metric: <
|
||||||
expectedMetricFamilyAsBytes := buf.Bytes()
|
expectedMetricFamilyAsBytes := buf.Bytes()
|
||||||
expectedMetricFamilyAsText := []byte(`# HELP name docstring
|
expectedMetricFamilyAsText := []byte(`# HELP name docstring
|
||||||
# TYPE name counter
|
# TYPE name counter
|
||||||
name{constname="constvalue",labelname="val1"} 1.0
|
name{constname="constvalue",labelname="val1"} 1
|
||||||
name{constname="constvalue",labelname="val2"} 1.0
|
name{constname="constvalue",labelname="val2"} 1
|
||||||
`)
|
`)
|
||||||
expectedMetricFamilyAsProtoText := []byte(`name: "name"
|
expectedMetricFamilyAsProtoText := []byte(`name: "name"
|
||||||
help: "docstring"
|
help: "docstring"
|
||||||
|
@ -267,8 +267,8 @@ collected metric "name" { label:<name:"constname" value:"\377" > label:<name:"la
|
||||||
complex{quantile="0.5"} NaN
|
complex{quantile="0.5"} NaN
|
||||||
complex{quantile="0.9"} NaN
|
complex{quantile="0.9"} NaN
|
||||||
complex{quantile="0.99"} NaN
|
complex{quantile="0.99"} NaN
|
||||||
complex_sum 0.0
|
complex_sum 0
|
||||||
complex_count 0.0
|
complex_count 0
|
||||||
`)
|
`)
|
||||||
histogram := prometheus.NewHistogram(prometheus.HistogramOpts{
|
histogram := prometheus.NewHistogram(prometheus.HistogramOpts{
|
||||||
Name: "complex",
|
Name: "complex",
|
||||||
|
@ -288,7 +288,7 @@ complex_count 0.0
|
||||||
}
|
}
|
||||||
externalMetricFamilyWithBucketSuffixAsText := []byte(`# HELP complex_bucket externaldocstring
|
externalMetricFamilyWithBucketSuffixAsText := []byte(`# HELP complex_bucket externaldocstring
|
||||||
# TYPE complex_bucket counter
|
# TYPE complex_bucket counter
|
||||||
complex_bucket 1.0
|
complex_bucket 1
|
||||||
`)
|
`)
|
||||||
externalMetricFamilyWithCountSuffix := &dto.MetricFamily{
|
externalMetricFamilyWithCountSuffix := &dto.MetricFamily{
|
||||||
Name: proto.String("complex_count"),
|
Name: proto.String("complex_count"),
|
||||||
|
@ -883,33 +883,33 @@ func TestHistogramVecRegisterGatherConcurrency(t *testing.T) {
|
||||||
func TestWriteToTextfile(t *testing.T) {
|
func TestWriteToTextfile(t *testing.T) {
|
||||||
expectedOut := `# HELP test_counter test counter
|
expectedOut := `# HELP test_counter test counter
|
||||||
# TYPE test_counter counter
|
# TYPE test_counter counter
|
||||||
test_counter{name="qux"} 1.0
|
test_counter{name="qux"} 1
|
||||||
# HELP test_gauge test gauge
|
# HELP test_gauge test gauge
|
||||||
# TYPE test_gauge gauge
|
# TYPE test_gauge gauge
|
||||||
test_gauge{name="baz"} 1.1
|
test_gauge{name="baz"} 1.1
|
||||||
# HELP test_hist test histogram
|
# HELP test_hist test histogram
|
||||||
# TYPE test_hist histogram
|
# TYPE test_hist histogram
|
||||||
test_hist_bucket{name="bar",le="0.005"} 0.0
|
test_hist_bucket{name="bar",le="0.005"} 0
|
||||||
test_hist_bucket{name="bar",le="0.01"} 0.0
|
test_hist_bucket{name="bar",le="0.01"} 0
|
||||||
test_hist_bucket{name="bar",le="0.025"} 0.0
|
test_hist_bucket{name="bar",le="0.025"} 0
|
||||||
test_hist_bucket{name="bar",le="0.05"} 0.0
|
test_hist_bucket{name="bar",le="0.05"} 0
|
||||||
test_hist_bucket{name="bar",le="0.1"} 0.0
|
test_hist_bucket{name="bar",le="0.1"} 0
|
||||||
test_hist_bucket{name="bar",le="0.25"} 0.0
|
test_hist_bucket{name="bar",le="0.25"} 0
|
||||||
test_hist_bucket{name="bar",le="0.5"} 0.0
|
test_hist_bucket{name="bar",le="0.5"} 0
|
||||||
test_hist_bucket{name="bar",le="1.0"} 1.0
|
test_hist_bucket{name="bar",le="1"} 1
|
||||||
test_hist_bucket{name="bar",le="2.5"} 1.0
|
test_hist_bucket{name="bar",le="2.5"} 1
|
||||||
test_hist_bucket{name="bar",le="5.0"} 2.0
|
test_hist_bucket{name="bar",le="5"} 2
|
||||||
test_hist_bucket{name="bar",le="10.0"} 2.0
|
test_hist_bucket{name="bar",le="10"} 2
|
||||||
test_hist_bucket{name="bar",le="+Inf"} 2.0
|
test_hist_bucket{name="bar",le="+Inf"} 2
|
||||||
test_hist_sum{name="bar"} 3.64
|
test_hist_sum{name="bar"} 3.64
|
||||||
test_hist_count{name="bar"} 2.0
|
test_hist_count{name="bar"} 2
|
||||||
# HELP test_summary test summary
|
# HELP test_summary test summary
|
||||||
# TYPE test_summary summary
|
# TYPE test_summary summary
|
||||||
test_summary{name="foo",quantile="0.5"} 10.0
|
test_summary{name="foo",quantile="0.5"} 10
|
||||||
test_summary{name="foo",quantile="0.9"} 20.0
|
test_summary{name="foo",quantile="0.9"} 20
|
||||||
test_summary{name="foo",quantile="0.99"} 20.0
|
test_summary{name="foo",quantile="0.99"} 20
|
||||||
test_summary_sum{name="foo"} 30.0
|
test_summary_sum{name="foo"} 30
|
||||||
test_summary_count{name="foo"} 2.0
|
test_summary_count{name="foo"} 2
|
||||||
`
|
`
|
||||||
|
|
||||||
registry := prometheus.NewRegistry()
|
registry := prometheus.NewRegistry()
|
||||||
|
@ -975,6 +975,6 @@ test_summary_count{name="foo"} 2.0
|
||||||
fileContents := string(fileBytes)
|
fileContents := string(fileBytes)
|
||||||
|
|
||||||
if fileContents != expectedOut {
|
if fileContents != expectedOut {
|
||||||
t.Error("file contents didn't match expected result")
|
t.Error("file contents didn't match unexpected")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,7 +135,7 @@ func TestCollectAndCompare(t *testing.T) {
|
||||||
|
|
||||||
expected := `
|
expected := `
|
||||||
|
|
||||||
some_total{ label1 = "value1" } 1.0
|
some_total{ label1 = "value1" } 1
|
||||||
`
|
`
|
||||||
|
|
||||||
if err := CollectAndCompare(c, strings.NewReader(metadata+expected), "some_total"); err != nil {
|
if err := CollectAndCompare(c, strings.NewReader(metadata+expected), "some_total"); err != nil {
|
||||||
|
@ -157,7 +157,7 @@ func TestCollectAndCompareNoLabel(t *testing.T) {
|
||||||
|
|
||||||
expected := `
|
expected := `
|
||||||
|
|
||||||
some_total 1.0
|
some_total 1
|
||||||
`
|
`
|
||||||
|
|
||||||
if err := CollectAndCompare(c, strings.NewReader(metadata+expected), "some_total"); err != nil {
|
if err := CollectAndCompare(c, strings.NewReader(metadata+expected), "some_total"); err != nil {
|
||||||
|
@ -185,10 +185,10 @@ func TestCollectAndCompareHistogram(t *testing.T) {
|
||||||
# TYPE some_histogram histogram
|
# TYPE some_histogram histogram
|
||||||
`,
|
`,
|
||||||
expect: `
|
expect: `
|
||||||
some_histogram{le="1"} 0.0
|
some_histogram{le="1"} 0
|
||||||
some_histogram{le="2"} 0.0
|
some_histogram{le="2"} 0
|
||||||
some_histogram{le="3"} 1.0
|
some_histogram{le="3"} 1
|
||||||
some_histogram_bucket{le="+Inf"} 1.0
|
some_histogram_bucket{le="+Inf"} 1
|
||||||
some_histogram_sum 2.5
|
some_histogram_sum 2.5
|
||||||
some_histogram_count 1
|
some_histogram_count 1
|
||||||
|
|
||||||
|
@ -208,12 +208,12 @@ func TestCollectAndCompareHistogram(t *testing.T) {
|
||||||
# TYPE some_histogram histogram
|
# TYPE some_histogram histogram
|
||||||
`,
|
`,
|
||||||
expect: `
|
expect: `
|
||||||
some_histogram_bucket{test="test",le="1"} 0.0
|
some_histogram_bucket{test="test",le="1"} 0
|
||||||
some_histogram_bucket{test="test",le="2"} 0.0
|
some_histogram_bucket{test="test",le="2"} 0
|
||||||
some_histogram_bucket{test="test",le="3"} 1.0
|
some_histogram_bucket{test="test",le="3"} 1
|
||||||
some_histogram_bucket{test="test",le="+Inf"} 1.0
|
some_histogram_bucket{test="test",le="+Inf"} 1
|
||||||
some_histogram_sum{test="test"} 2.5
|
some_histogram_sum{test="test"} 2.5
|
||||||
some_histogram_count{test="test"} 1.0
|
some_histogram_count{test="test"} 1
|
||||||
|
|
||||||
`,
|
`,
|
||||||
observation: 2.5,
|
observation: 2.5,
|
||||||
|
@ -256,7 +256,7 @@ func TestNoMetricFilter(t *testing.T) {
|
||||||
c.Inc()
|
c.Inc()
|
||||||
|
|
||||||
expected := `
|
expected := `
|
||||||
some_total{label1="value1"} 1.0
|
some_total{label1="value1"} 1
|
||||||
`
|
`
|
||||||
|
|
||||||
if err := CollectAndCompare(c, strings.NewReader(metadata+expected)); err != nil {
|
if err := CollectAndCompare(c, strings.NewReader(metadata+expected)); err != nil {
|
||||||
|
@ -280,7 +280,7 @@ func TestMetricNotFound(t *testing.T) {
|
||||||
c.Inc()
|
c.Inc()
|
||||||
|
|
||||||
expected := `
|
expected := `
|
||||||
some_other_metric{label1="value1"} 1.0
|
some_other_metric{label1="value1"} 1
|
||||||
`
|
`
|
||||||
|
|
||||||
expectedError := `
|
expectedError := `
|
||||||
|
@ -288,13 +288,13 @@ metric output does not match expectation; want:
|
||||||
|
|
||||||
# HELP some_other_metric A value that represents a counter.
|
# HELP some_other_metric A value that represents a counter.
|
||||||
# TYPE some_other_metric counter
|
# TYPE some_other_metric counter
|
||||||
some_other_metric{label1="value1"} 1.0
|
some_other_metric{label1="value1"} 1
|
||||||
|
|
||||||
got:
|
got:
|
||||||
|
|
||||||
# HELP some_total A value that represents a counter.
|
# HELP some_total A value that represents a counter.
|
||||||
# TYPE some_total counter
|
# TYPE some_total counter
|
||||||
some_total{label1="value1"} 1.0
|
some_total{label1="value1"} 1
|
||||||
`
|
`
|
||||||
|
|
||||||
err := CollectAndCompare(c, strings.NewReader(metadata+expected))
|
err := CollectAndCompare(c, strings.NewReader(metadata+expected))
|
||||||
|
|
Loading…
Reference in New Issue