MCPcopy
hub / github.com/google/mtail / SetInt

Function SetInt

internal/metrics/datum/datum.go:146–155  ·  view source on GitHub ↗

SetInt sets an integer datum to the provided value and timestamp, or panics if the Datum is not an IntDatum.

(d Datum, v int64, ts time.Time)

Source from the content-addressed store, hash-verified

144
145// SetInt sets an integer datum to the provided value and timestamp, or panics if the Datum is not an IntDatum.
146func SetInt(d Datum, v int64, ts time.Time) {
147 switch d := d.(type) {
148 case *Int:
149 d.Set(v, ts)
150 case *Buckets:
151 d.Observe(float64(v), ts)
152 default:
153 panic(fmt.Sprintf("datum %v is not an Int", d))
154 }
155}
156
157// SetFloat sets a floating-point Datum to the provided value and timestamp, or panics if the Datum is not a FloatDatum.
158func SetFloat(d Datum, v float64, ts time.Time) {

Callers 12

TestExpireOldDatumFunction · 0.92
TestExpireManyMetricsFunction · 0.92
TestEmitLabelSetFunction · 0.92
TestMetricJSONRoundTripFunction · 0.92
ReadTestDataFunction · 0.92
VisitBeforeMethod · 0.92
TestDatumSetInstrsFunction · 0.92
TestDatumFetchInstrsFunction · 0.92
executeMethod · 0.92
TestMetricToCollectdFunction · 0.92
TestMetricToGraphiteFunction · 0.92
TestMetricToStatsdFunction · 0.92

Calls 2

ObserveMethod · 0.80
SetMethod · 0.45

Tested by 9

TestExpireOldDatumFunction · 0.74
TestExpireManyMetricsFunction · 0.74
TestEmitLabelSetFunction · 0.74
TestMetricJSONRoundTripFunction · 0.74
TestDatumSetInstrsFunction · 0.74
TestDatumFetchInstrsFunction · 0.74
TestMetricToCollectdFunction · 0.74
TestMetricToGraphiteFunction · 0.74
TestMetricToStatsdFunction · 0.74