Skip to content
This repository was archived by the owner on Dec 5, 2025. It is now read-only.

Commit 3e852de

Browse files
author
billpyang
committed
fix style
1 parent 16392ff commit 3e852de

File tree

2 files changed

+13
-23
lines changed

2 files changed

+13
-23
lines changed

src/Facades/Metric.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33
namespace Overtrue\LaravelOpenTelemetry\Facades;
44

55
use Illuminate\Support\Facades\Facade;
6-
use OpenTelemetry\API\Metrics\CounterInterface;
7-
use OpenTelemetry\API\Metrics\GaugeInterface;
8-
use OpenTelemetry\API\Metrics\HistogramInterface;
9-
use OpenTelemetry\API\Metrics\ObservableGaugeInterface;
106

117
/**
128
* @method static void enable()
@@ -27,4 +23,4 @@ protected static function getFacadeAccessor(): string
2723
{
2824
return \Overtrue\LaravelOpenTelemetry\Support\Metric::class;
2925
}
30-
}
26+
}

src/Support/Metric.php

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,19 @@
44

55
use Illuminate\Contracts\Foundation\Application;
66
use Illuminate\Support\Facades\Log;
7+
use OpenTelemetry\API\Metrics\CounterInterface;
78
use OpenTelemetry\API\Metrics\GaugeInterface;
89
use OpenTelemetry\API\Metrics\HistogramInterface;
910
use OpenTelemetry\API\Metrics\MeterInterface;
1011
use OpenTelemetry\API\Metrics\Noop\NoopMeter;
11-
use OpenTelemetry\API\Metrics\CounterInterface;
1212
use OpenTelemetry\API\Metrics\ObservableGaugeInterface;
1313
use Throwable;
1414

1515
class Metric
1616
{
1717
private static ?bool $enabled = null;
1818

19-
public function __construct(protected Application $app)
20-
{
21-
}
22-
19+
public function __construct(protected Application $app) {}
2320

2421
// ======================= Enable/Disable Management =======================
2522

@@ -42,15 +39,14 @@ public function isEnabled(): bool
4239
return self::$enabled;
4340
}
4441

45-
4642
// ======================= Core OpenTelemetry API =======================
4743

4844
/**
4945
* Get the meter instance
5046
*/
5147
public function meter(): MeterInterface
5248
{
53-
if (!$this->isEnabled()) {
49+
if (! $this->isEnabled()) {
5450
return new NoopMeter;
5551
}
5652

@@ -67,29 +63,27 @@ public function meter(): MeterInterface
6763
}
6864
}
6965

70-
public function createCounter(string $name, ?string $unit = null,
71-
?string $description = null, array $advisory = []): CounterInterface
66+
public function createCounter(string $name, ?string $unit = null,
67+
?string $description = null, array $advisory = []): CounterInterface
7268
{
7369
return $this->meter()->createCounter($name, $unit, $description, $advisory);
7470
}
7571

76-
public function createHistogram(string $name, ?string $unit = null,
77-
?string $description = null, array $advisory = []): HistogramInterface
72+
public function createHistogram(string $name, ?string $unit = null,
73+
?string $description = null, array $advisory = []): HistogramInterface
7874
{
7975
return $this->meter()->createHistogram($name, $unit, $description, $advisory);
8076
}
8177

82-
public function createGauge(string $name, ?string $unit = null,
83-
?string $description = null, array $advisory = []): GaugeInterface
78+
public function createGauge(string $name, ?string $unit = null,
79+
?string $description = null, array $advisory = []): GaugeInterface
8480
{
8581
return $this->meter()->createGauge($name, $unit, $description, $advisory);
8682
}
8783

88-
public function createObservableGauge(string $name, ?string $unit = null,
89-
?string $description = null, array|callable $advisory = [], callable ...$callbacks): ObservableGaugeInterface
84+
public function createObservableGauge(string $name, ?string $unit = null,
85+
?string $description = null, array|callable $advisory = [], callable ...$callbacks): ObservableGaugeInterface
9086
{
9187
return $this->meter()->createObservableGauge($name, $unit, $description, $advisory, $callbacks);
9288
}
93-
94-
95-
}
89+
}

0 commit comments

Comments
 (0)