mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-09 23:24:05 -08:00
docs: textparse.Parser return type mismatch
The docs suggest the Next method returns a bool, but that's not the case (`Entry` is an int). ``` // Next advances the parser to the next sample. It returns false if no // more samples were read or an error occurred. Next() (Entry, error) ``` The docs were first added ind80a3de235
in 2017. Back then the signature was indeed `func (p *Parser) Next() bool`. But then it got refactored in76a4a46cb0
and the signature changed with it, yet docs stayed the same - and eventually made their way into the `Parser` interface. However, the Protobuf parser does have the right wording:5de2df752f
``` // Next advances the parser to the next "sample" (emulating the behavior of a // text format parser). It returns (EntryInvalid, io.EOF) if no samples were // read. ``` Changing all other implementations (and the interface itself) to match this doc. Signed-off-by: Ondrej Kokes <ondrej.kokes@gmail.com>
This commit is contained in:
parent
8736772053
commit
2e30f1231b
|
@ -71,8 +71,8 @@ type Parser interface {
|
|||
// if the scrape protocol or metric type does not support created timestamps.
|
||||
CreatedTimestamp() *int64
|
||||
|
||||
// Next advances the parser to the next sample. It returns false if no
|
||||
// more samples were read or an error occurred.
|
||||
// Next advances the parser to the next sample.
|
||||
// It returns (EntryInvalid, io.EOF) if no samples were read.
|
||||
Next() (Entry, error)
|
||||
}
|
||||
|
||||
|
|
|
@ -239,8 +239,8 @@ func (p *OpenMetricsParser) parseError(exp string, got token) error {
|
|||
return fmt.Errorf("%s, got %q (%q) while parsing: %q", exp, p.l.b[p.l.start:e], got, p.l.b[p.start:e])
|
||||
}
|
||||
|
||||
// Next advances the parser to the next sample. It returns false if no
|
||||
// more samples were read or an error occurred.
|
||||
// Next advances the parser to the next sample.
|
||||
// It returns (EntryInvalid, io.EOF) if no samples were read.
|
||||
func (p *OpenMetricsParser) Next() (Entry, error) {
|
||||
var err error
|
||||
|
||||
|
|
|
@ -280,8 +280,8 @@ func (p *PromParser) parseError(exp string, got token) error {
|
|||
return fmt.Errorf("%s, got %q (%q) while parsing: %q", exp, p.l.b[p.l.start:e], got, p.l.b[p.start:e])
|
||||
}
|
||||
|
||||
// Next advances the parser to the next sample. It returns false if no
|
||||
// more samples were read or an error occurred.
|
||||
// Next advances the parser to the next sample.
|
||||
// It returns (EntryInvalid, io.EOF) if no samples were read.
|
||||
func (p *PromParser) Next() (Entry, error) {
|
||||
var err error
|
||||
|
||||
|
|
Loading…
Reference in a new issue