mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-25 13:44:05 -08:00
Delete debugging lines, amend error message for unit
Signed-off-by: Arianna Vespri <arianna.vespri@yahoo.it>
This commit is contained in:
parent
3d6a92a25e
commit
51e78d9a32
|
@ -424,15 +424,13 @@ func (p *ProtobufParser) Next() (Entry, error) {
|
||||||
return EntryInvalid, fmt.Errorf("unknown metric type for metric %q: %s", name, p.mf.GetType())
|
return EntryInvalid, fmt.Errorf("unknown metric type for metric %q: %s", name, p.mf.GetType())
|
||||||
}
|
}
|
||||||
unit := p.mf.GetUnit()
|
unit := p.mf.GetUnit()
|
||||||
fmt.Println("This is the unit:", unit)
|
|
||||||
fmt.Println("This is the name:", name)
|
|
||||||
if len(unit) > 0 {
|
if len(unit) > 0 {
|
||||||
sfx := fmt.Sprintf("_%s", unit)
|
sfx := fmt.Sprintf("_%s", unit)
|
||||||
if p.mf.GetType() == dto.MetricType_COUNTER {
|
if p.mf.GetType() == dto.MetricType_COUNTER {
|
||||||
sfx = fmt.Sprintf("_%s_total", unit)
|
sfx = fmt.Sprintf("_%s_total", unit)
|
||||||
}
|
}
|
||||||
if !strings.HasSuffix(name, sfx) {
|
if !strings.HasSuffix(name, sfx) {
|
||||||
return EntryInvalid, fmt.Errorf("invalid unit for metric %q: %s", name, unit)
|
return EntryInvalid, fmt.Errorf("unit %q not a suffix of metric %q", name, unit)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p.metricBytes.Reset()
|
p.metricBytes.Reset()
|
||||||
|
|
Loading…
Reference in a new issue