(in io.Reader)
| 121 | } |
| 122 | |
| 123 | func (p *TextParser) reset(in io.Reader) { |
| 124 | p.metricFamiliesByName = map[string]*dto.MetricFamily{} |
| 125 | if p.buf == nil { |
| 126 | p.buf = bufio.NewReader(in) |
| 127 | } else { |
| 128 | p.buf.Reset(in) |
| 129 | } |
| 130 | p.err = nil |
| 131 | p.lineCount = 0 |
| 132 | if p.summaries == nil || len(p.summaries) > 0 { |
| 133 | p.summaries = map[uint64]*dto.Metric{} |
| 134 | } |
| 135 | if p.histograms == nil || len(p.histograms) > 0 { |
| 136 | p.histograms = map[uint64]*dto.Metric{} |
| 137 | } |
| 138 | p.currentQuantile = math.NaN() |
| 139 | p.currentBucket = math.NaN() |
| 140 | } |
| 141 | |
| 142 | // startOfLine represents the state where the next byte read from p.buf is the |
| 143 | // start of a line (or whitespace leading up to it). |
no outgoing calls