Skip to content

Commit 415a572

Browse files
committed
handle missing meter observers
if no observers are registered for a meter's instruments, some tests were emitting php warnings: - foreach() argument must be of type array|object, null given - Undefined array key XXX null coalesce to an empty array to make the test happy.
1 parent 7eb3abb commit 415a572

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/SDK/Metrics/Meter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function updateConfigurator(Configurator $configurator): void
8181
$this->config = $configurator->resolve($this->instrumentationScope);
8282

8383
$startTimestamp = $this->clock->now();
84-
foreach ($this->instruments->observers[self::instrumentationScopeId($this->instrumentationScope)] as [$instrument, $stalenessHandler, $r]) {
84+
foreach ($this->instruments->observers[self::instrumentationScopeId($this->instrumentationScope)] ?? [] as [$instrument, $stalenessHandler, $r]) {
8585
if ($this->config->isEnabled() && $r->dormant) {
8686
$this->metricFactory->createAsynchronousObserver(
8787
$this->registry,

0 commit comments

Comments
 (0)