1818use OpenTelemetry \Context \Propagation \ResponsePropagatorInterface ;
1919use OpenTelemetry \Context \Propagation \TextMapPropagatorInterface ;
2020use OpenTelemetry \SDK \Common \Attribute \Attributes ;
21+ use OpenTelemetry \SDK \Common \Distribution \DistributionConfiguration ;
22+ use OpenTelemetry \SDK \Common \Distribution \DistributionRegistry ;
23+ use OpenTelemetry \SDK \Common \Distribution \SdkDistribution ;
2124use OpenTelemetry \SDK \Common \Instrumentation \InstrumentationScopeFactory ;
2225use OpenTelemetry \SDK \Common \InstrumentationScope \Configurator ;
2326use OpenTelemetry \SDK \Logs \EventLoggerProvider ;
@@ -169,6 +172,7 @@ final class OpenTelemetrySdk implements ComponentProvider
169172 * }>
170173 * },
171174 * },
175+ * distribution: list<ComponentPlugin<DistributionConfiguration>>,
172176 * } $properties
173177 */
174178 #[\Override]
@@ -194,6 +198,13 @@ public function createPlugin(array $properties, Context $context): SdkBuilder
194198 return $ sdkBuilder ;
195199 }
196200
201+ $ distributionProperties = new DistributionRegistry ();
202+ foreach ($ properties ['distribution ' ] as $ distributionConfiguration ) {
203+ $ distributionProperties ->add ($ distributionConfiguration ->create ($ context ));
204+ }
205+
206+ $ distributionConfiguration = $ distributionProperties ->getDistributionConfiguration (SdkDistribution::class) ?? new SdkDistribution ();
207+
197208 //priorities: 1. attributes 2. attributes_list, 3. detected (after applying include/exclude)
198209 $ schemaUrl = $ properties ['resource ' ]['schema_url ' ];
199210 /** @var ResourceDetectorInterface[] $detectors */
@@ -277,6 +288,7 @@ public function createPlugin(array $properties, Context $context): SdkBuilder
277288 linkCountLimit: $ properties ['tracer_provider ' ]['limits ' ]['link_count_limit ' ],
278289 ),
279290 configurator: $ configurator ,
291+ spanSuppressionStrategy: $ distributionConfiguration ->spanSuppressionStrategy ,
280292 );
281293
282294 // </editor-fold>
@@ -419,6 +431,7 @@ public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $buil
419431 ->append ($ this ->getMeterProviderConfig ($ registry , $ builder ))
420432 ->append ($ this ->getLoggerProviderConfig ($ registry , $ builder ))
421433 ->append ($ this ->getExperimentalResponsePropagatorConfig ($ registry , $ builder ))
434+ ->append ($ registry ->componentMap ('distribution ' , DistributionConfiguration::class)->defaultValue ([]))
422435 ->end ();
423436
424437 return $ node ;
0 commit comments