func ComponentsFromOTelConfig()

in cmd/distrogen/otel_config.go [27:51]


func ComponentsFromOTelConfig(otelConfig map[string]any) (*DistributionComponents, error) {
	components := &DistributionComponents{}
	var err error
	components.Receivers, err = readComponentsFromSection("receivers", otelConfig)
	if err != nil && !errors.Is(err, ErrSectionNotFound) {
		return nil, err
	}
	components.Processors, err = readComponentsFromSection("processors", otelConfig)
	if err != nil && !errors.Is(err, ErrSectionNotFound) {
		return nil, err
	}
	components.Exporters, err = readComponentsFromSection("exporters", otelConfig)
	if err != nil && !errors.Is(err, ErrSectionNotFound) {
		return nil, err
	}
	components.Connectors, err = readComponentsFromSection("connectors", otelConfig)
	if err != nil && !errors.Is(err, ErrSectionNotFound) {
		return nil, err
	}
	components.Extensions, err = readComponentsFromSection("extensions", otelConfig)
	if err != nil && !errors.Is(err, ErrSectionNotFound) {
		return nil, err
	}
	return components, nil
}