MCPcopy Create free account
hub / github.com/prometheus/common / readTokenAsLabelName

Method readTokenAsLabelName

expfmt/text_parse.go:629–641  ·  view source on GitHub ↗

readTokenAsLabelName copies a label name from p.buf into p.currentToken. The first byte considered is the byte already read (now in p.currentByte). The first byte not part of a label name is still copied into p.currentByte, but not into p.currentToken.

()

Source from the content-addressed store, hash-verified

627// The first byte not part of a label name is still copied into p.currentByte,
628// but not into p.currentToken.
629func (p *TextParser) readTokenAsLabelName() {
630 p.currentToken.Reset()
631 if !isValidLabelNameStart(p.currentByte) {
632 return
633 }
634 for {
635 p.currentToken.WriteByte(p.currentByte)
636 p.currentByte, p.err = p.buf.ReadByte()
637 if p.err != nil || !isValidLabelNameContinuation(p.currentByte) {
638 return
639 }
640 }
641}
642
643// readTokenAsLabelValue copies a label value from p.buf into p.currentToken.
644// In contrast to the other 'readTokenAs...' functions, which start with the

Callers 1

startLabelNameMethod · 0.95

Calls 3

isValidLabelNameStartFunction · 0.85
WriteByteMethod · 0.80

Tested by

no test coverage detected