44
55use Illuminate \Contracts \Foundation \Application ;
66use Illuminate \Support \Facades \Log ;
7+ use OpenTelemetry \API \Metrics \CounterInterface ;
78use OpenTelemetry \API \Metrics \GaugeInterface ;
89use OpenTelemetry \API \Metrics \HistogramInterface ;
910use OpenTelemetry \API \Metrics \MeterInterface ;
1011use OpenTelemetry \API \Metrics \Noop \NoopMeter ;
11- use OpenTelemetry \API \Metrics \CounterInterface ;
1212use OpenTelemetry \API \Metrics \ObservableGaugeInterface ;
1313use Throwable ;
1414
1515class 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