forked from mirror/client_golang
Remove redundant __name__ label from protobuf output.
Change-Id: I72d5dbccb0325d6edf7abe5bca88dc5a6001029c
This commit is contained in:
parent
ee34486fa1
commit
b83e1b7cad
|
@ -281,6 +281,13 @@ func (r *registry) dumpDelimitedPB(w io.Writer) {
|
|||
container.Metric.dumpChildren(f)
|
||||
|
||||
for name, value := range container.BaseLabels {
|
||||
if model.LabelName(name) == model.MetricNameLabel {
|
||||
// The name is already in MetricFamily.
|
||||
continue
|
||||
// TODO: Once JSON is history, do not anymore
|
||||
// add the __name__ label to BaseLabels and
|
||||
// then remove this check.
|
||||
}
|
||||
p := &dto.LabelPair{
|
||||
Name: proto.String(name),
|
||||
Value: proto.String(value),
|
||||
|
|
|
@ -229,10 +229,6 @@ func testHandler(t tester) {
|
|||
Name: proto.String("externalbasename"),
|
||||
Value: proto.String("externalbasevalue"),
|
||||
},
|
||||
&dto.LabelPair{
|
||||
Name: proto.String("__name__"),
|
||||
Value: proto.String("externalname"),
|
||||
},
|
||||
},
|
||||
Counter: &dto.Counter{
|
||||
Value: proto.Float64(1),
|
||||
|
@ -272,10 +268,6 @@ func testHandler(t tester) {
|
|||
Name: proto.String("basename"),
|
||||
Value: proto.String("basevalue"),
|
||||
},
|
||||
&dto.LabelPair{
|
||||
Name: proto.String("__name__"),
|
||||
Value: proto.String("name"),
|
||||
},
|
||||
},
|
||||
Counter: &dto.Counter{
|
||||
Value: proto.Float64(1),
|
||||
|
@ -291,10 +283,6 @@ func testHandler(t tester) {
|
|||
Name: proto.String("basename"),
|
||||
Value: proto.String("basevalue"),
|
||||
},
|
||||
&dto.LabelPair{
|
||||
Name: proto.String("__name__"),
|
||||
Value: proto.String("name"),
|
||||
},
|
||||
},
|
||||
Counter: &dto.Counter{
|
||||
Value: proto.Float64(1),
|
||||
|
|
Loading…
Reference in New Issue