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

Method reset

expfmt/text_parse.go:123–140  ·  view source on GitHub ↗
(in io.Reader)

Source from the content-addressed store, hash-verified

121}
122
123func (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).

Callers 2

TextToMetricFamiliesMethod · 0.95

Calls

no outgoing calls

Tested by 1