NewConstHistogramWithCreatedTimestamp does the same thing as NewConstHistogram but sets the created timestamp.
( desc *Desc, count uint64, sum float64, buckets map[float64]uint64, ct time.Time, labelValues ...string, )
| 1399 | |
| 1400 | // NewConstHistogramWithCreatedTimestamp does the same thing as NewConstHistogram but sets the created timestamp. |
| 1401 | func NewConstHistogramWithCreatedTimestamp( |
| 1402 | desc *Desc, |
| 1403 | count uint64, |
| 1404 | sum float64, |
| 1405 | buckets map[float64]uint64, |
| 1406 | ct time.Time, |
| 1407 | labelValues ...string, |
| 1408 | ) (Metric, error) { |
| 1409 | if desc.err != nil { |
| 1410 | return nil, desc.err |
| 1411 | } |
| 1412 | if err := validateLabelValues(labelValues, len(desc.variableLabels.names)); err != nil { |
| 1413 | return nil, err |
| 1414 | } |
| 1415 | return &constHistogram{ |
| 1416 | desc: desc, |
| 1417 | count: count, |
| 1418 | sum: sum, |
| 1419 | buckets: buckets, |
| 1420 | labelPairs: MakeLabelPairs(desc, labelValues), |
| 1421 | createdTs: timestamppb.New(ct), |
| 1422 | }, nil |
| 1423 | } |
| 1424 | |
| 1425 | // MustNewConstHistogramWithCreatedTimestamp is a version of NewConstHistogramWithCreatedTimestamp that panics where |
| 1426 | // NewConstHistogramWithCreatedTimestamp would have returned an error. |