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

Method readingLabels

expfmt/text_parse.go:255–269  ·  view source on GitHub ↗

readingLabels represents the state where the last byte read (now in p.currentByte) is either the first byte of the label set (i.e. a '{'), or the first byte of the value (otherwise).

()

Source from the content-addressed store, hash-verified

253// p.currentByte) is either the first byte of the label set (i.e. a '{'), or the
254// first byte of the value (otherwise).
255func (p *TextParser) readingLabels() stateFn {
256 // Summaries/histograms are special. We have to reset the
257 // currentLabels map, currentQuantile and currentBucket before starting to
258 // read labels.
259 if p.currentMF.GetType() == dto.MetricType_SUMMARY || p.currentMF.GetType() == dto.MetricType_HISTOGRAM {
260 p.currentLabels = map[string]string{}
261 p.currentLabels[string(model.MetricNameLabel)] = p.currentMF.GetName()
262 p.currentQuantile = math.NaN()
263 p.currentBucket = math.NaN()
264 }
265 if p.currentByte != '{' {
266 return p.readingValue
267 }
268 return p.startLabelName
269}
270
271// startLabelName represents the state where the next byte read from p.buf is
272// the start of a label name (or whitespace leading up to it).

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected