Skip to content

Commit

Permalink
chore: add missing methods
Browse files Browse the repository at this point in the history
  • Loading branch information
cdaguerre committed Oct 2, 2024
1 parent 0ba41f5 commit 8c54cb3
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 1 deletion.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@
"minimum-stability": "dev",
"prefer-stable": true,
"allow-plugins": {
"php-http/discovery": false
"php-http/discovery": false,
"tbachert/spi": false
}
},
"extra": {
Expand Down
5 changes: 5 additions & 0 deletions src/Metrics/CounterAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,9 @@ public function add($amount, iterable $attributes = [], $context = null): void

$counter->incBy($amount, $labelValues);
}

public function isEnabled(): bool
{
return true;
}
}
5 changes: 5 additions & 0 deletions src/Metrics/HistogramAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,9 @@ public function record($amount, iterable $attributes = [], $context = null): voi
);
$histogram->observe($amount, $labelValues);
}

public function isEnabled(): bool
{
return true;
}
}
6 changes: 6 additions & 0 deletions src/Metrics/Meter.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

use OpenTelemetry\API\Metrics\AsynchronousInstrument;
use OpenTelemetry\API\Metrics\CounterInterface;
use OpenTelemetry\API\Metrics\GaugeInterface;
use OpenTelemetry\API\Metrics\HistogramInterface;
use OpenTelemetry\API\Metrics\MeterInterface;
use OpenTelemetry\API\Metrics\ObservableCallbackInterface;
Expand Down Expand Up @@ -79,6 +80,11 @@ public function createHistogram(string $name, string|null $unit = null, string|n
return new HistogramAdapter($name, $description ?: '', $this->collectorRegistry);
}

public function createGauge(string $name, string|null $unit = null, string|null $description = null, array $advisory = []): GaugeInterface

Check failure on line 83 in src/Metrics/Meter.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.3)

Method Instrumentation\Metrics\Meter::createGauge() has parameter $advisory with no value type specified in iterable type array.

Check failure on line 83 in src/Metrics/Meter.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.3)

Method Instrumentation\Metrics\Meter::createGauge() has parameter $advisory with no value type specified in iterable type array.
{
throw new \LogicException(\sprintf('Method %s is not implemented', __METHOD__));
}

/**
* Creates an `ObservableGauge`.
*
Expand Down
5 changes: 5 additions & 0 deletions src/Metrics/UpDownCounterAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,9 @@ public function add($amount, iterable $attributes = [], $context = null): void
$gauge->decBy(abs($amount), $labelValues);
}
}

public function isEnabled(): bool
{
return true;
}
}

0 comments on commit 8c54cb3

Please sign in to comment.