(value float64)
| 295 | } |
| 296 | |
| 297 | func (p *promTextParser) addSummary(value float64) { |
| 298 | hash := p.currSeries.Hash() |
| 299 | |
| 300 | p.currSeries, _, _ = removeLabel(p.currSeries, labels.MetricName) |
| 301 | |
| 302 | s, ok := p.summaries[hash] |
| 303 | if !ok { |
| 304 | if v := len(p.currMF.metrics); v == cap(p.currMF.metrics) { |
| 305 | s = &Summary{} |
| 306 | p.currMF.metrics = append(p.currMF.metrics, Metric{ |
| 307 | labels: copyLabels(p.currSeries), |
| 308 | summary: s, |
| 309 | }) |
| 310 | } else { |
| 311 | p.currMF.metrics = p.currMF.metrics[:v+1] |
| 312 | if p.currMF.metrics[v].summary == nil { |
| 313 | p.currMF.metrics[v].summary = &Summary{} |
| 314 | } |
| 315 | p.currMF.metrics[v].summary.sum = 0 |
| 316 | p.currMF.metrics[v].summary.count = 0 |
| 317 | p.currMF.metrics[v].summary.quantiles = p.currMF.metrics[v].summary.quantiles[:0] |
| 318 | p.currMF.metrics[v].labels = p.currMF.metrics[v].labels[:0] |
| 319 | p.currMF.metrics[v].labels = append(p.currMF.metrics[v].labels, p.currSeries...) |
| 320 | s = p.currMF.metrics[v].summary |
| 321 | } |
| 322 | |
| 323 | p.summaries[hash] = s |
| 324 | } |
| 325 | |
| 326 | switch { |
| 327 | case p.isQuantile: |
| 328 | s.quantiles = append(s.quantiles, Quantile{quantile: p.currQuantile, value: value}) |
| 329 | case p.isSum: |
| 330 | s.sum = value |
| 331 | case p.isCount: |
| 332 | s.count = value |
| 333 | } |
| 334 | } |
| 335 | |
| 336 | func (p *promTextParser) addHistogram(value float64) { |
| 337 | hash := p.currSeries.Hash() |
no test coverage detected