func()

in processor/lsmintervalprocessor/internal/merger/value.go [732:778]


func (v *Value) mergeMetric(
	metricID identity.Metric,
	m pdataMetric,
	otherM pmetric.Metric,
) error {
	switch typ := otherM.Type(); typ {
	case pmetric.MetricTypeSum:
		return mergeDataPoints(
			otherM.Sum().DataPoints(),
			metricID,
			m,
			v.addSumDataPoint,
			otherM.Sum().AggregationTemporality(),
			v.maxExponentialHistogramBuckets,
		)
	case pmetric.MetricTypeSummary:
		return mergeDataPoints(
			otherM.Summary().DataPoints(),
			metricID,
			m,
			v.addSummaryDataPoint,
			// Assume summary to be cumulative temporality
			pmetric.AggregationTemporalityCumulative,
			v.maxExponentialHistogramBuckets,
		)
	case pmetric.MetricTypeHistogram:
		return mergeDataPoints(
			otherM.Histogram().DataPoints(),
			metricID,
			m,
			v.addHistogramDataPoint,
			otherM.Histogram().AggregationTemporality(),
			v.maxExponentialHistogramBuckets,
		)
	case pmetric.MetricTypeExponentialHistogram:
		return mergeDataPoints(
			otherM.ExponentialHistogram().DataPoints(),
			metricID,
			m,
			v.addExponentialHistogramDataPoint,
			otherM.ExponentialHistogram().AggregationTemporality(),
			v.maxExponentialHistogramBuckets,
		)
	default:
		return fmt.Errorf("unsupported metric type: %s", typ)
	}
}