diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 8c4dc08c6b7..501243819cf 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -3023,23 +3023,23 @@ }, { "ImportPath": "github.com/prometheus/client_golang/prometheus", - "Comment": "v0.9.1", - "Rev": "abad2d1bd44235a26707c172eab6bca5bf2dbad3" + "Comment": "v0.9.2", + "Rev": "505eaef017263e299324067d40ca2c48f6a2cf50" }, { "ImportPath": "github.com/prometheus/client_golang/prometheus/internal", - "Comment": "v0.9.1", - "Rev": "abad2d1bd44235a26707c172eab6bca5bf2dbad3" + "Comment": "v0.9.2", + "Rev": "505eaef017263e299324067d40ca2c48f6a2cf50" }, { "ImportPath": "github.com/prometheus/client_golang/prometheus/promhttp", - "Comment": "v0.9.1", - "Rev": "abad2d1bd44235a26707c172eab6bca5bf2dbad3" + "Comment": "v0.9.2", + "Rev": "505eaef017263e299324067d40ca2c48f6a2cf50" }, { "ImportPath": "github.com/prometheus/client_golang/prometheus/testutil", - "Comment": "v0.9.1", - "Rev": "abad2d1bd44235a26707c172eab6bca5bf2dbad3" + "Comment": "v0.9.2", + "Rev": "505eaef017263e299324067d40ca2c48f6a2cf50" }, { "ImportPath": "github.com/prometheus/client_model/go", diff --git a/staging/src/k8s.io/apiextensions-apiserver/Godeps/Godeps.json b/staging/src/k8s.io/apiextensions-apiserver/Godeps/Godeps.json index e4bf34f4669..ac34a6d2308 100644 --- a/staging/src/k8s.io/apiextensions-apiserver/Godeps/Godeps.json +++ b/staging/src/k8s.io/apiextensions-apiserver/Godeps/Godeps.json @@ -572,15 +572,18 @@ }, { "ImportPath": "github.com/prometheus/client_golang/prometheus", - "Rev": "abad2d1bd44235a26707c172eab6bca5bf2dbad3" + "Comment": "v0.9.2", + "Rev": "505eaef017263e299324067d40ca2c48f6a2cf50" }, { "ImportPath": "github.com/prometheus/client_golang/prometheus/internal", - "Rev": "abad2d1bd44235a26707c172eab6bca5bf2dbad3" + "Comment": "v0.9.2", + "Rev": "505eaef017263e299324067d40ca2c48f6a2cf50" }, { "ImportPath": "github.com/prometheus/client_golang/prometheus/promhttp", - "Rev": "abad2d1bd44235a26707c172eab6bca5bf2dbad3" + "Comment": "v0.9.2", + "Rev": "505eaef017263e299324067d40ca2c48f6a2cf50" }, { "ImportPath": "github.com/prometheus/client_model/go", diff --git a/staging/src/k8s.io/apiserver/Godeps/Godeps.json b/staging/src/k8s.io/apiserver/Godeps/Godeps.json index b6740c17447..93a4643b0c6 100644 --- a/staging/src/k8s.io/apiserver/Godeps/Godeps.json +++ b/staging/src/k8s.io/apiserver/Godeps/Godeps.json @@ -552,15 +552,18 @@ }, { "ImportPath": "github.com/prometheus/client_golang/prometheus", - "Rev": "abad2d1bd44235a26707c172eab6bca5bf2dbad3" + "Comment": "v0.9.2", + "Rev": "505eaef017263e299324067d40ca2c48f6a2cf50" }, { "ImportPath": "github.com/prometheus/client_golang/prometheus/internal", - "Rev": "abad2d1bd44235a26707c172eab6bca5bf2dbad3" + "Comment": "v0.9.2", + "Rev": "505eaef017263e299324067d40ca2c48f6a2cf50" }, { "ImportPath": "github.com/prometheus/client_golang/prometheus/promhttp", - "Rev": "abad2d1bd44235a26707c172eab6bca5bf2dbad3" + "Comment": "v0.9.2", + "Rev": "505eaef017263e299324067d40ca2c48f6a2cf50" }, { "ImportPath": "github.com/prometheus/client_model/go", diff --git a/staging/src/k8s.io/kube-aggregator/Godeps/Godeps.json b/staging/src/k8s.io/kube-aggregator/Godeps/Godeps.json index 4eb704d7e0f..d74932301a5 100644 --- a/staging/src/k8s.io/kube-aggregator/Godeps/Godeps.json +++ b/staging/src/k8s.io/kube-aggregator/Godeps/Godeps.json @@ -220,11 +220,13 @@ }, { "ImportPath": "github.com/prometheus/client_golang/prometheus", - "Rev": "abad2d1bd44235a26707c172eab6bca5bf2dbad3" + "Comment": "v0.9.2", + "Rev": "505eaef017263e299324067d40ca2c48f6a2cf50" }, { "ImportPath": "github.com/prometheus/client_golang/prometheus/internal", - "Rev": "abad2d1bd44235a26707c172eab6bca5bf2dbad3" + "Comment": "v0.9.2", + "Rev": "505eaef017263e299324067d40ca2c48f6a2cf50" }, { "ImportPath": "github.com/prometheus/client_model/go", diff --git a/staging/src/k8s.io/sample-apiserver/Godeps/Godeps.json b/staging/src/k8s.io/sample-apiserver/Godeps/Godeps.json index 4d0e4d0192e..71ba183c635 100644 --- a/staging/src/k8s.io/sample-apiserver/Godeps/Godeps.json +++ b/staging/src/k8s.io/sample-apiserver/Godeps/Godeps.json @@ -204,11 +204,13 @@ }, { "ImportPath": "github.com/prometheus/client_golang/prometheus", - "Rev": "abad2d1bd44235a26707c172eab6bca5bf2dbad3" + "Comment": "v0.9.2", + "Rev": "505eaef017263e299324067d40ca2c48f6a2cf50" }, { "ImportPath": "github.com/prometheus/client_golang/prometheus/internal", - "Rev": "abad2d1bd44235a26707c172eab6bca5bf2dbad3" + "Comment": "v0.9.2", + "Rev": "505eaef017263e299324067d40ca2c48f6a2cf50" }, { "ImportPath": "github.com/prometheus/client_model/go", diff --git a/vendor/github.com/prometheus/client_golang/prometheus/desc.go b/vendor/github.com/prometheus/client_golang/prometheus/desc.go index 7b8827ffbca..1d034f871cb 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/desc.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/desc.go @@ -93,7 +93,7 @@ func NewDesc(fqName, help string, variableLabels []string, constLabels Labels) * // First add only the const label names and sort them... for labelName := range constLabels { if !checkLabelName(labelName) { - d.err = fmt.Errorf("%q is not a valid label name", labelName) + d.err = fmt.Errorf("%q is not a valid label name for metric %q", labelName, fqName) return d } labelNames = append(labelNames, labelName) @@ -115,7 +115,7 @@ func NewDesc(fqName, help string, variableLabels []string, constLabels Labels) * // dimension with a different mix between preset and variable labels. for _, labelName := range variableLabels { if !checkLabelName(labelName) { - d.err = fmt.Errorf("%q is not a valid label name", labelName) + d.err = fmt.Errorf("%q is not a valid label name for metric %q", labelName, fqName) return d } labelNames = append(labelNames, "$"+labelName) diff --git a/vendor/github.com/prometheus/client_golang/prometheus/registry.go b/vendor/github.com/prometheus/client_golang/prometheus/registry.go index f98c81a8691..b5e70b93fa1 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/registry.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/registry.go @@ -872,7 +872,13 @@ func checkMetricConsistency( h = hashAddByte(h, separatorByte) // Make sure label pairs are sorted. We depend on it for the consistency // check. - sort.Sort(labelPairSorter(dtoMetric.Label)) + if !sort.IsSorted(labelPairSorter(dtoMetric.Label)) { + // We cannot sort dtoMetric.Label in place as it is immutable by contract. + copiedLabels := make([]*dto.LabelPair, len(dtoMetric.Label)) + copy(copiedLabels, dtoMetric.Label) + sort.Sort(labelPairSorter(copiedLabels)) + dtoMetric.Label = copiedLabels + } for _, lp := range dtoMetric.Label { h = hashAdd(h, lp.GetName()) h = hashAddByte(h, separatorByte) @@ -903,8 +909,8 @@ func checkDescConsistency( } // Is the desc consistent with the content of the metric? - lpsFromDesc := make([]*dto.LabelPair, 0, len(dtoMetric.Label)) - lpsFromDesc = append(lpsFromDesc, desc.constLabelPairs...) + lpsFromDesc := make([]*dto.LabelPair, len(desc.constLabelPairs), len(dtoMetric.Label)) + copy(lpsFromDesc, desc.constLabelPairs) for _, l := range desc.variableLabels { lpsFromDesc = append(lpsFromDesc, &dto.LabelPair{ Name: proto.String(l), diff --git a/vendor/github.com/prometheus/client_golang/prometheus/testutil/testutil.go b/vendor/github.com/prometheus/client_golang/prometheus/testutil/testutil.go index d148af9b855..e344cc853c2 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/testutil/testutil.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/testutil/testutil.go @@ -37,7 +37,6 @@ import ( "bytes" "fmt" "io" - "reflect" "github.com/prometheus/common/expfmt" @@ -125,38 +124,43 @@ func CollectAndCompare(c prometheus.Collector, expected io.Reader, metricNames . // exposition format. If any metricNames are provided, only metrics with those // names are compared. func GatherAndCompare(g prometheus.Gatherer, expected io.Reader, metricNames ...string) error { - metrics, err := g.Gather() + got, err := g.Gather() if err != nil { return fmt.Errorf("gathering metrics failed: %s", err) } if metricNames != nil { - metrics = filterMetrics(metrics, metricNames) + got = filterMetrics(got, metricNames) } var tp expfmt.TextParser - expectedMetrics, err := tp.TextToMetricFamilies(expected) + wantRaw, err := tp.TextToMetricFamilies(expected) if err != nil { return fmt.Errorf("parsing expected metrics failed: %s", err) } + want := internal.NormalizeMetricFamilies(wantRaw) - if !reflect.DeepEqual(metrics, internal.NormalizeMetricFamilies(expectedMetrics)) { - // Encode the gathered output to the readable text format for comparison. - var buf1 bytes.Buffer - enc := expfmt.NewEncoder(&buf1, expfmt.FmtText) - for _, mf := range metrics { - if err := enc.Encode(mf); err != nil { - return fmt.Errorf("encoding result failed: %s", err) - } - } - // Encode normalized expected metrics again to generate them in the same ordering - // the registry does to spot differences more easily. - var buf2 bytes.Buffer - enc = expfmt.NewEncoder(&buf2, expfmt.FmtText) - for _, mf := range internal.NormalizeMetricFamilies(expectedMetrics) { - if err := enc.Encode(mf); err != nil { - return fmt.Errorf("encoding result failed: %s", err) - } - } + return compare(got, want) +} +// compare encodes both provided slices of metric families into the text format, +// compares their string message, and returns an error if they do not match. +// The error contains the encoded text of both the desired and the actual +// result. +func compare(got, want []*dto.MetricFamily) error { + var gotBuf, wantBuf bytes.Buffer + enc := expfmt.NewEncoder(&gotBuf, expfmt.FmtText) + for _, mf := range got { + if err := enc.Encode(mf); err != nil { + return fmt.Errorf("encoding gathered metrics failed: %s", err) + } + } + enc = expfmt.NewEncoder(&wantBuf, expfmt.FmtText) + for _, mf := range want { + if err := enc.Encode(mf); err != nil { + return fmt.Errorf("encoding expected metrics failed: %s", err) + } + } + + if wantBuf.String() != gotBuf.String() { return fmt.Errorf(` metric output does not match expectation; want: @@ -165,7 +169,8 @@ metric output does not match expectation; want: got: %s -`, buf2.String(), buf1.String()) +`, wantBuf.String(), gotBuf.String()) + } return nil } diff --git a/vendor/github.com/prometheus/client_golang/prometheus/timer.go b/vendor/github.com/prometheus/client_golang/prometheus/timer.go index b8fc5f18c85..8d5f1052337 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/timer.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/timer.go @@ -39,13 +39,16 @@ func NewTimer(o Observer) *Timer { // ObserveDuration records the duration passed since the Timer was created with // NewTimer. It calls the Observe method of the Observer provided during -// construction with the duration in seconds as an argument. ObserveDuration is -// usually called with a defer statement. +// construction with the duration in seconds as an argument. The observed +// duration is also returned. ObserveDuration is usually called with a defer +// statement. // // Note that this method is only guaranteed to never observe negative durations // if used with Go1.9+. -func (t *Timer) ObserveDuration() { +func (t *Timer) ObserveDuration() time.Duration { + d := time.Since(t.begin) if t.observer != nil { - t.observer.Observe(time.Since(t.begin).Seconds()) + t.observer.Observe(d.Seconds()) } + return d } diff --git a/vendor/k8s.io/kube-openapi/pkg/generators/rules/OWNERS b/vendor/k8s.io/kube-openapi/pkg/generators/rules/OWNERS old mode 100644 new mode 100755