$metricReaders */ public function __construct( ?ContextStorageInterface $contextStorage, ResourceInfo $resource, ClockInterface $clock, AttributesFactoryInterface $attributesFactory, InstrumentationScopeFactoryInterface $instrumentationScopeFactory, iterable $metricReaders, ViewRegistryInterface $viewRegistry, ?ExemplarFilterInterface $exemplarFilter, StalenessHandlerFactoryInterface $stalenessHandlerFactory, MetricFactoryInterface $metricFactory = null ) { $this->metricFactory = $metricFactory ?? new StreamFactory(); $this->resource = $resource; $this->clock = $clock; $this->instrumentationScopeFactory = $instrumentationScopeFactory; $this->metricReaders = $metricReaders; $this->viewRegistry = $viewRegistry; $this->exemplarFilter = $exemplarFilter; $this->stalenessHandlerFactory = $stalenessHandlerFactory; $this->instruments = new MeterInstruments(); $registry = new MetricRegistry($contextStorage, $attributesFactory, $clock); $this->registry = $registry; $this->writer = $registry; } public function getMeter( string $name, ?string $version = null, ?string $schemaUrl = null, iterable $attributes = [] ): MeterInterface { if ($this->closed || Sdk::isDisabled()) { //@todo create meter provider from factory, and move Sdk::isDisabled() there return new NoopMeter(); } return new Meter( $this->metricFactory, $this->resource, $this->clock, $this->stalenessHandlerFactory, $this->metricReaders, $this->viewRegistry, $this->exemplarFilter, $this->instruments, $this->instrumentationScopeFactory->create($name, $version, $schemaUrl, $attributes), $this->registry, $this->writer, ); } public function shutdown(): bool { if ($this->closed) { return false; } $this->closed = true; $success = true; foreach ($this->metricReaders as $metricReader) { if (!$metricReader->shutdown()) { $success = false; } } return $success; } public function forceFlush(): bool { if ($this->closed) { return false; } $success = true; foreach ($this->metricReaders as $metricReader) { if (!$metricReader->forceFlush()) { $success = false; } } return $success; } public static function builder(): MeterProviderBuilder { return new MeterProviderBuilder(); } }