Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ExportingReader.php

function ExportingReader::add

Overrides MetricSourceRegistryInterface::add

File

vendor/open-telemetry/sdk/Metrics/MetricReader/ExportingReader.php, line 52

Class

ExportingReader

Namespace

OpenTelemetry\SDK\Metrics\MetricReader

Code

public function add(MetricSourceProviderInterface $provider, MetricMetadataInterface $metadata, StalenessHandlerInterface $stalenessHandler) : void {
    if ($this->closed) {
        return;
    }
    if (!$this->exporter instanceof AggregationTemporalitySelectorInterface) {
        return;
    }
    if (!($temporality = $this->exporter
        ->temporality($metadata))) {
        return;
    }
    $source = $provider->create($temporality);
    $sourceId = spl_object_id($source);
    $this->sources[$sourceId] = $source;
    if (!$provider instanceof StreamMetricSourceProvider) {
        $stalenessHandler->onStale(function () use ($sourceId) : void {
            unset($this->sources[$sourceId]);
        });
        return;
    }
    $streamId = $provider->streamId;
    $registry = $provider->metricCollector;
    $registryId = spl_object_id($registry);
    $this->registries[$registryId] = $registry;
    $this->streamIds[$registryId][$streamId][] = $sourceId;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal