MCPcopy
hub / github.com/prometheus/prometheus / AppendHistogram

Method AppendHistogram

storage/remote/write_handler.go:513–534  ·  view source on GitHub ↗
(ref storage.SeriesRef, l labels.Labels, t int64, h *histogram.Histogram, fh *histogram.FloatHistogram)

Source from the content-addressed store, hash-verified

511}
512
513func (app *remoteWriteAppender) AppendHistogram(ref storage.SeriesRef, l labels.Labels, t int64, h *histogram.Histogram, fh *histogram.FloatHistogram) (storage.SeriesRef, error) {
514 var err error
515 if t > app.maxTime {
516 return 0, fmt.Errorf("%w: timestamp is too far in the future", storage.ErrOutOfBounds)
517 }
518
519 if h != nil && histogram.IsExponentialSchemaReserved(h.Schema) && h.Schema > histogram.ExponentialSchemaMax {
520 if err = h.ReduceResolution(histogram.ExponentialSchemaMax); err != nil {
521 return 0, err
522 }
523 }
524 if fh != nil && histogram.IsExponentialSchemaReserved(fh.Schema) && fh.Schema > histogram.ExponentialSchemaMax {
525 if err = fh.ReduceResolution(histogram.ExponentialSchemaMax); err != nil {
526 return 0, err
527 }
528 }
529
530 if ref, err = app.Appender.AppendHistogram(ref, l, t, h, fh); err != nil {
531 return 0, err
532 }
533 return ref, nil
534}
535
536func (app *remoteWriteAppender) AppendExemplar(ref storage.SeriesRef, l labels.Labels, e exemplar.Exemplar) (storage.SeriesRef, error) {
537 if e.Ts > app.maxTime {

Callers

nothing calls this directly

Calls 3

AppendHistogramMethod · 0.65
ReduceResolutionMethod · 0.45

Tested by

no test coverage detected