Skip to content

Commit

Permalink
Delete debugging lines, amend error message for unit
Browse files Browse the repository at this point in the history
Signed-off-by: Arianna Vespri <[email protected]>
  • Loading branch information
vesari committed Dec 20, 2023
1 parent 3d6a92a commit 51e78d9
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions model/textparse/protobufparse.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
unit := p.mf.GetUnit()
fmt.Println("This is the unit:", unit)
fmt.Println("This is the name:", name)
if len(unit) > 0 {
sfx := fmt.Sprintf("_%s", unit)
if p.mf.GetType() == dto.MetricType_COUNTER {
sfx = fmt.Sprintf("_%s_total", unit)
}
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()
Expand Down

0 comments on commit 51e78d9

Please sign in to comment.