mirror of https://github.com/k3s-io/k3s
update vendor prometheus/client_golang to newest release
parent
1eb8d3b5c5
commit
c6a16d6017
|
@ -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",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -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 {
|
||||
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 result failed: %s", err)
|
||||
return fmt.Errorf("encoding gathered metrics 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) {
|
||||
enc = expfmt.NewEncoder(&wantBuf, expfmt.FmtText)
|
||||
for _, mf := range want {
|
||||
if err := enc.Encode(mf); err != nil {
|
||||
return fmt.Errorf("encoding result failed: %s", err)
|
||||
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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
0
vendor/k8s.io/kube-openapi/pkg/generators/rules/OWNERS
generated
vendored
Normal file → Executable file
0
vendor/k8s.io/kube-openapi/pkg/generators/rules/OWNERS
generated
vendored
Normal file → Executable file
Loading…
Reference in New Issue