NewConstSummaryWithCreatedTimestamp does the same thing as NewConstSummary but sets the created timestamp.
( desc *Desc, count uint64, sum float64, quantiles map[float64]float64, ct time.Time, labelValues ...string, )
| 789 | |
| 790 | // NewConstSummaryWithCreatedTimestamp does the same thing as NewConstSummary but sets the created timestamp. |
| 791 | func NewConstSummaryWithCreatedTimestamp( |
| 792 | desc *Desc, |
| 793 | count uint64, |
| 794 | sum float64, |
| 795 | quantiles map[float64]float64, |
| 796 | ct time.Time, |
| 797 | labelValues ...string, |
| 798 | ) (Metric, error) { |
| 799 | if desc.err != nil { |
| 800 | return nil, desc.err |
| 801 | } |
| 802 | if err := validateLabelValues(labelValues, len(desc.variableLabels.names)); err != nil { |
| 803 | return nil, err |
| 804 | } |
| 805 | return &constSummary{ |
| 806 | desc: desc, |
| 807 | count: count, |
| 808 | sum: sum, |
| 809 | quantiles: quantiles, |
| 810 | labelPairs: MakeLabelPairs(desc, labelValues), |
| 811 | createdTs: timestamppb.New(ct), |
| 812 | }, nil |
| 813 | } |
| 814 | |
| 815 | // MustNewConstSummaryWithCreatedTimestamp is a version of NewConstSummaryWithCreatedTimestamp that panics where |
| 816 | // NewConstSummaryWithCreatedTimestamp would have returned an error. |