public void customize()

in common/src/main/java/co/elastic/otel/common/ChainingSpanProcessorsInstaller.java [37:63]


  public void customize(AutoConfigurationCustomizer autoConfigurationCustomizer) {
    List<ChainingSpanProcessorAutoConfiguration> autoConfigs = new ArrayList<>();
    ServiceLoader.load(
            ChainingSpanProcessorAutoConfiguration.class,
            ChainingSpanProcessorsInstaller.class.getClassLoader())
        .iterator()
        .forEachRemaining(autoConfigs::add);
    if (!autoConfigs.isEmpty()) {

      MutableCompositeSpanProcessor exporterProcessor = new MutableCompositeSpanProcessor();

      autoConfigurationCustomizer.addSpanProcessorCustomizer(
          (spanProcessor, config) -> {
            if (isSpanExportingProcessor(spanProcessor)) {
              if (exporterProcessor.isEmpty()) {
                exporterProcessor.addDelegate(spanProcessor);
                return createProcessorChain(autoConfigs, config, exporterProcessor);
              } else {
                exporterProcessor.addDelegate(spanProcessor);
                // return NOOP, because exporterProcessor is already registered
                return SpanProcessor.composite();
              }
            }
            return spanProcessor;
          });
    }
  }