MCPcopy
hub / github.com/prometheus/client_golang / NewConstSummary

Function NewConstSummary

prometheus/summary.go:752–772  ·  view source on GitHub ↗

NewConstSummary returns a metric representing a Prometheus summary with fixed values for the count, sum, and quantiles. As those parameters cannot be changed, the returned value does not implement the Summary interface (but only the Metric interface). Users of this package will not have much use for

(
	desc *Desc,
	count uint64,
	sum float64,
	quantiles map[float64]float64,
	labelValues ...string,
)

Source from the content-addressed store, hash-verified

750// NewConstSummary returns an error if the length of labelValues is not
751// consistent with the variable labels in Desc or if Desc is invalid.
752func NewConstSummary(
753 desc *Desc,
754 count uint64,
755 sum float64,
756 quantiles map[float64]float64,
757 labelValues ...string,
758) (Metric, error) {
759 if desc.err != nil {
760 return nil, desc.err
761 }
762 if err := validateLabelValues(labelValues, len(desc.variableLabels.names)); err != nil {
763 return nil, err
764 }
765 return &constSummary{
766 desc: desc,
767 count: count,
768 sum: sum,
769 quantiles: quantiles,
770 labelPairs: MakeLabelPairs(desc, labelValues),
771 }, nil
772}
773
774// MustNewConstSummary is a version of NewConstSummary that panics where
775// NewConstMetric would have returned an error.

Callers 1

MustNewConstSummaryFunction · 0.85

Calls 2

validateLabelValuesFunction · 0.85
MakeLabelPairsFunction · 0.85

Tested by

no test coverage detected