func checkDuplicateAggConfigForName()

in cmd/otelinmemexporter/store.go [484:511]


func checkDuplicateAggConfigForName(src, target AggregationConfig) error {
	if src.Name != target.Name {
		return nil
	}

	if len(src.MatchLabelValues) != len(target.MatchLabelValues) {
		return nil
	}

	for k, v := range src.MatchLabelValues {
		targetV, ok := target.MatchLabelValues[k]
		if !ok || v != targetV {
			return nil
		}
	}

	if src.Type != target.Type {
		return fmt.Errorf("cannot record same metric with different types: %s", src.Name)
	}

	if src.Type == Percentile && target.Type == Percentile {
		if src.Percentile != target.Percentile {
			return nil
		}
	}

	return fmt.Errorf("duplicate config found for name: %s", src.Name)
}