func()

in cmd/otelinmemexporter/store.go [376:407]


func (s *Store) mergeHistogramDataPoints(
	name string,
	from pmetric.HistogramDataPointSlice,
	resAttrs pcommon.Map,
) {
	if s.hists == nil {
		s.hists = make(keyToGroupToMetric[pmetric.HistogramDataPoint])
	}

	for i := 0; i < from.Len(); i++ {
		fromDP := from.At(i)
		if fromDP.Count() == 0 {
			// Skip histogram data points with no population.
			continue
		}

		attrs := fromDP.Attributes()
		for _, cfg := range s.filterCfgs(name, attrs, resAttrs) {
			toDP := getMergeTo(s.hists, pmetric.NewHistogramDataPoint, cfg, attrs, resAttrs)
			switch cfg.Type {
			case Sum, Percentile:
				addHistogramDataPoint(fromDP, toDP)
			default:
				s.logger.Warn(
					"aggregation type not available for histogram data points",
					zap.String("name", name),
					zap.String("agg_type", string(cfg.Type)),
				)
			}
		}
	}
}