Skip to content

Commit

Permalink
Allow custom counters implementing CounterInterface to be exported (#676
Browse files Browse the repository at this point in the history
)

Signed-off-by: Erdem Köse <[email protected]>
  • Loading branch information
erdemkose authored May 18, 2022
1 parent 85282b5 commit 2e4c849
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Contrib/Prometheus/PrometheusExporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace OpenTelemetry\Contrib\Prometheus;

use OpenTelemetry\API\Metrics as API;
use OpenTelemetry\SDK\Metrics\Counter;
use OpenTelemetry\SDK\Metrics\Exceptions\CantBeExported;
use OpenTelemetry\SDK\Metrics\Exporters\AbstractExporter;
use Prometheus\CollectorRegistry;
Expand All @@ -28,8 +27,8 @@ public function __construct(CollectorRegistry $registry, string $namespace = '')
protected function doExport(iterable $metrics): void
{
foreach ($metrics as $metric) {
switch (get_class($metric)) {
case Counter::class:
switch (true) {
case $metric instanceof API\CounterInterface:
$this->exportCounter($metric);

break;
Expand Down

0 comments on commit 2e4c849

Please sign in to comment.