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).
()
| 253 | // p.currentByte) is either the first byte of the label set (i.e. a '{'), or the |
| 254 | // first byte of the value (otherwise). |
| 255 | func (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). |
nothing calls this directly
no outgoing calls
no test coverage detected