function MetricRegistry::record
Overrides MetricWriterInterface::record
File
-
vendor/
open-telemetry/ sdk/ Metrics/ MetricRegistry/ MetricRegistry.php, line 93
Class
- MetricRegistry
- @internal
Namespace
OpenTelemetry\SDK\Metrics\MetricRegistryCode
public function record(Instrument $instrument, $value, iterable $attributes = [], $context = null) : void {
$context = Context::resolve($context, $this->contextStorage);
$attributes = $this->attributesFactory
->builder($attributes)
->build();
$timestamp = $this->clock
->now();
$instrumentId = spl_object_id($instrument);
foreach ($this->instrumentToStreams[$instrumentId] ?? [] as $streamId) {
if ($aggregator = $this->synchronousAggregators[$streamId] ?? null) {
$aggregator->record($value, $attributes, $context, $timestamp);
}
}
}