mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-11 08:04:04 -08:00
Merge pull request #588 from prometheus/update-vendoring
Update vendored client_golang to 0.3.2.
This commit is contained in:
commit
7de2cf2fce
16
Godeps/Godeps.json
generated
16
Godeps/Godeps.json
generated
|
@ -29,23 +29,23 @@
|
|||
},
|
||||
{
|
||||
"ImportPath": "github.com/prometheus/client_golang/extraction",
|
||||
"Comment": "0.3.1",
|
||||
"Rev": "f688948916633c167d810a9548d4b775da43b0b0"
|
||||
"Comment": "0.3.2",
|
||||
"Rev": "1cf6d4b964951c63779ba7513c57fe389b609014"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/prometheus/client_golang/model",
|
||||
"Comment": "0.3.1",
|
||||
"Rev": "f688948916633c167d810a9548d4b775da43b0b0"
|
||||
"Comment": "0.3.2",
|
||||
"Rev": "1cf6d4b964951c63779ba7513c57fe389b609014"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/prometheus/client_golang/prometheus",
|
||||
"Comment": "0.3.1",
|
||||
"Rev": "f688948916633c167d810a9548d4b775da43b0b0"
|
||||
"Comment": "0.3.2",
|
||||
"Rev": "1cf6d4b964951c63779ba7513c57fe389b609014"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/prometheus/client_golang/text",
|
||||
"Comment": "0.3.1",
|
||||
"Rev": "f688948916633c167d810a9548d4b775da43b0b0"
|
||||
"Comment": "0.3.2",
|
||||
"Rev": "1cf6d4b964951c63779ba7513c57fe389b609014"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/prometheus/client_model/go",
|
||||
|
|
2
Godeps/_workspace/src/github.com/prometheus/client_golang/model/metric.go
generated
vendored
2
Godeps/_workspace/src/github.com/prometheus/client_golang/model/metric.go
generated
vendored
|
@ -101,7 +101,7 @@ type COWMetric struct {
|
|||
|
||||
// Set sets a label name in the wrapped Metric to a given value and copies the
|
||||
// Metric initially, if it is not already a copy.
|
||||
func (m COWMetric) Set(ln LabelName, lv LabelValue) {
|
||||
func (m *COWMetric) Set(ln LabelName, lv LabelValue) {
|
||||
m.doCOW()
|
||||
m.Metric[ln] = lv
|
||||
}
|
||||
|
|
49
Godeps/_workspace/src/github.com/prometheus/client_golang/model/metric_test.go
generated
vendored
49
Godeps/_workspace/src/github.com/prometheus/client_golang/model/metric_test.go
generated
vendored
|
@ -70,3 +70,52 @@ func BenchmarkMetric(b *testing.B) {
|
|||
testMetric(b)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCOWMetric(t *testing.T) {
|
||||
testMetric := Metric{
|
||||
"to_delete": "test1",
|
||||
"to_change": "test2",
|
||||
}
|
||||
|
||||
scenarios := []struct {
|
||||
fn func(*COWMetric)
|
||||
out Metric
|
||||
}{
|
||||
{
|
||||
fn: func(cm *COWMetric) {
|
||||
cm.Delete("to_delete")
|
||||
},
|
||||
out: Metric{
|
||||
"to_change": "test2",
|
||||
},
|
||||
},
|
||||
{
|
||||
fn: func(cm *COWMetric) {
|
||||
cm.Set("to_change", "changed")
|
||||
},
|
||||
out: Metric{
|
||||
"to_delete": "test1",
|
||||
"to_change": "changed",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for i, s := range scenarios {
|
||||
orig := testMetric.Clone()
|
||||
cm := &COWMetric{
|
||||
Metric: orig,
|
||||
}
|
||||
|
||||
s.fn(cm)
|
||||
|
||||
// Test that the original metric was not modified.
|
||||
if !orig.Equal(testMetric) {
|
||||
t.Fatalf("%d. original metric changed; expected %v, got %v", i, testMetric, orig)
|
||||
}
|
||||
|
||||
// Test that the new metric has the right changes.
|
||||
if !cm.Metric.Equal(s.out) {
|
||||
t.Fatalf("%d. copied metric doesn't contain expected changes; expected %v, got %v", i, s.out, cm.Metric)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue