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

Breadcrumb

  1. Drupal Core 11.1.x

MultiObserver.php

Namespace

OpenTelemetry\SDK\Metrics\MetricRegistry

File

vendor/open-telemetry/sdk/Metrics/MetricRegistry/MultiObserver.php

View source
<?php

declare (strict_types=1);
namespace OpenTelemetry\SDK\Metrics\MetricRegistry;

use OpenTelemetry\API\Metrics\ObserverInterface;
use OpenTelemetry\Context\Context;
use OpenTelemetry\SDK\Common\Attribute\AttributesFactoryInterface;
use OpenTelemetry\SDK\Metrics\Stream\WritableMetricStreamInterface;

/**
 * @internal
 */
final class MultiObserver implements ObserverInterface {
    
    /** @var list<WritableMetricStreamInterface>  */
    public array $writers = [];
    public function __construct(AttributesFactoryInterface $attributesFactory, int $timestamp) {
    }
    public function observe($amount, iterable $attributes = []) : void {
        $context = Context::getRoot();
        $attributes = $this->attributesFactory
            ->builder($attributes)
            ->build();
        foreach ($this->writers as $writer) {
            $writer->record($amount, $attributes, $context, $this->timestamp);
        }
    }

}

Classes

Title Deprecated Summary
MultiObserver @internal

API Navigation

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