MCPcopy Create free account
hub / github.com/cortexproject/cortex / createDataPointsGauge

Function createDataPointsGauge

integration/e2ecortex/client.go:222–233  ·  view source on GitHub ↗
(newMetric pmetric.Metric, attributes map[string]any, samples []prompb.Sample)

Source from the content-addressed store, hash-verified

220}
221
222func createDataPointsGauge(newMetric pmetric.Metric, attributes map[string]any, samples []prompb.Sample) {
223 newMetric.SetEmptyGauge()
224 for _, sample := range samples {
225 datapoint := newMetric.Gauge().DataPoints().AppendEmpty()
226 datapoint.SetDoubleValue(sample.Value)
227 datapoint.SetTimestamp(pcommon.Timestamp(sample.Timestamp * time.Millisecond.Nanoseconds()))
228 err := datapoint.Attributes().FromRaw(attributes)
229 if err != nil {
230 panic(err)
231 }
232 }
233}
234
235func createDataPointsExponentialHistogram(newMetric pmetric.Metric, attributes map[string]any, histograms []prompb.Histogram) {
236 newMetric.SetEmptyExponentialHistogram().SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)

Callers 1

Calls 1

AttributesMethod · 0.45

Tested by

no test coverage detected