mirror of
https://github.com/prometheus/prometheus.git
synced 2025-01-16 00:08:39 -08:00
lint
This commit is contained in:
parent
a65ed08885
commit
f6bc568d8b
|
@ -486,7 +486,7 @@ func (p *OpenMetricsParser) parseMetricSuffix(t token) (Entry, error) {
|
||||||
var ts float64
|
var ts float64
|
||||||
// A float is enough to hold what we need for millisecond resolution.
|
// A float is enough to hold what we need for millisecond resolution.
|
||||||
if ts, err = parseFloat(yoloString(p.l.buf()[1:])); err != nil {
|
if ts, err = parseFloat(yoloString(p.l.buf()[1:])); err != nil {
|
||||||
return EntryInvalid, fmt.Errorf("%v while parsing: %q", err, p.l.b[p.start:p.l.i])
|
return EntryInvalid, fmt.Errorf("%w while parsing: %q", err, p.l.b[p.start:p.l.i])
|
||||||
}
|
}
|
||||||
if math.IsNaN(ts) || math.IsInf(ts, 0) {
|
if math.IsNaN(ts) || math.IsInf(ts, 0) {
|
||||||
return EntryInvalid, fmt.Errorf("invalid timestamp %f", ts)
|
return EntryInvalid, fmt.Errorf("invalid timestamp %f", ts)
|
||||||
|
|
|
@ -302,7 +302,7 @@ foo_total 17.0 1520879607.789 # {id="counter-test"} 5`
|
||||||
|
|
||||||
func TestUTF8OpenMetricsParse(t *testing.T) {
|
func TestUTF8OpenMetricsParse(t *testing.T) {
|
||||||
model.NameValidationScheme = model.UTF8Validation
|
model.NameValidationScheme = model.UTF8Validation
|
||||||
defer func(){
|
defer func() {
|
||||||
model.NameValidationScheme = model.LegacyValidation
|
model.NameValidationScheme = model.LegacyValidation
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
|
|
@ -462,7 +462,7 @@ func (p *PromParser) parseMetricSuffix(t token) (Entry, error) {
|
||||||
}
|
}
|
||||||
var err error
|
var err error
|
||||||
if p.val, err = parseFloat(yoloString(p.l.buf())); err != nil {
|
if p.val, err = parseFloat(yoloString(p.l.buf())); err != nil {
|
||||||
return EntryInvalid, fmt.Errorf("%v while parsing: %q", err, p.l.b[p.start:p.l.i])
|
return EntryInvalid, fmt.Errorf("%w while parsing: %q", err, p.l.b[p.start:p.l.i])
|
||||||
}
|
}
|
||||||
// Ensure canonical NaN value.
|
// Ensure canonical NaN value.
|
||||||
if math.IsNaN(p.val) {
|
if math.IsNaN(p.val) {
|
||||||
|
@ -475,7 +475,7 @@ func (p *PromParser) parseMetricSuffix(t token) (Entry, error) {
|
||||||
case tTimestamp:
|
case tTimestamp:
|
||||||
p.hasTS = true
|
p.hasTS = true
|
||||||
if p.ts, err = strconv.ParseInt(yoloString(p.l.buf()), 10, 64); err != nil {
|
if p.ts, err = strconv.ParseInt(yoloString(p.l.buf()), 10, 64); err != nil {
|
||||||
return EntryInvalid, fmt.Errorf("%v while parsing: %q", err, p.l.b[p.start:p.l.i])
|
return EntryInvalid, fmt.Errorf("%w while parsing: %q", err, p.l.b[p.start:p.l.i])
|
||||||
}
|
}
|
||||||
if t2 := p.nextToken(); t2 != tLinebreak {
|
if t2 := p.nextToken(); t2 != tLinebreak {
|
||||||
return EntryInvalid, p.parseError("expected next entry after timestamp", t2)
|
return EntryInvalid, p.parseError("expected next entry after timestamp", t2)
|
||||||
|
|
Loading…
Reference in a new issue