1414use Sentry \Options ;
1515use Sentry \State \HubAdapter ;
1616
17- use function Sentry \trace_metrics ;
17+ use function Sentry \traceMetrics ;
1818
1919final class TraceMetricsTest extends TestCase
2020{
@@ -26,9 +26,9 @@ protected function setUp(): void
2626
2727 public function testCounterMetrics (): void
2828 {
29- trace_metrics ()->count ('test-count ' , 2 , ['foo ' => 'bar ' ]);
30- trace_metrics ()->count ('test-count ' , 2 , ['foo ' => 'bar ' ]);
31- trace_metrics ()->flush ();
29+ traceMetrics ()->count ('test-count ' , 2 , ['foo ' => 'bar ' ]);
30+ traceMetrics ()->count ('test-count ' , 2 , ['foo ' => 'bar ' ]);
31+ traceMetrics ()->flush ();
3232
3333 $ this ->assertCount (1 , StubTransport::$ events );
3434 $ event = StubTransport::$ events [0 ];
@@ -43,8 +43,8 @@ public function testCounterMetrics(): void
4343
4444 public function testGaugeMetrics (): void
4545 {
46- trace_metrics ()->gauge ('test-gauge ' , 10 , ['foo ' => 'bar ' ]);
47- trace_metrics ()->flush ();
46+ traceMetrics ()->gauge ('test-gauge ' , 10 , ['foo ' => 'bar ' ]);
47+ traceMetrics ()->flush ();
4848
4949 $ this ->assertCount (1 , StubTransport::$ events );
5050 $ event = StubTransport::$ events [0 ];
@@ -59,8 +59,8 @@ public function testGaugeMetrics(): void
5959
6060 public function testDistributionMetrics (): void
6161 {
62- trace_metrics ()->distribution ('test-distribution ' , 10 , ['foo ' => 'bar ' ]);
63- trace_metrics ()->flush ();
62+ traceMetrics ()->distribution ('test-distribution ' , 10 , ['foo ' => 'bar ' ]);
63+ traceMetrics ()->flush ();
6464 $ this ->assertCount (1 , StubTransport::$ events );
6565 $ event = StubTransport::$ events [0 ];
6666 $ this ->assertCount (1 , $ event ->getMetrics ());
@@ -75,9 +75,9 @@ public function testDistributionMetrics(): void
7575 public function testMetricsBufferFull (): void
7676 {
7777 for ($ i = 0 ; $ i < MetricsAggregator::METRICS_BUFFER_SIZE + 100 ; ++$ i ) {
78- trace_metrics ()->count ('test ' , 1 , ['foo ' => 'bar ' ]);
78+ traceMetrics ()->count ('test ' , 1 , ['foo ' => 'bar ' ]);
7979 }
80- trace_metrics ()->flush ();
80+ traceMetrics ()->flush ();
8181 $ this ->assertCount (1 , StubTransport::$ events );
8282 $ event = StubTransport::$ events [0 ];
8383 $ metrics = $ event ->getMetrics ();
@@ -90,8 +90,8 @@ public function testEnableMetrics(): void
9090 'enable_metrics ' => false ,
9191 ]), StubTransport::getInstance ()));
9292
93- trace_metrics ()->count ('test-count ' , 2 , ['foo ' => 'bar ' ]);
94- trace_metrics ()->flush ();
93+ traceMetrics ()->count ('test-count ' , 2 , ['foo ' => 'bar ' ]);
94+ traceMetrics ()->flush ();
9595
9696 $ this ->assertEmpty (StubTransport::$ events );
9797 }
@@ -106,8 +106,8 @@ public function testBeforeSendMetricAltersContent()
106106 },
107107 ]), StubTransport::getInstance ()));
108108
109- trace_metrics ()->count ('test-count ' , 2 , ['foo ' => 'bar ' ]);
110- trace_metrics ()->flush ();
109+ traceMetrics ()->count ('test-count ' , 2 , ['foo ' => 'bar ' ]);
110+ traceMetrics ()->flush ();
111111
112112 $ this ->assertCount (1 , StubTransport::$ events );
113113 $ event = StubTransport::$ events [0 ];
@@ -119,8 +119,8 @@ public function testBeforeSendMetricAltersContent()
119119
120120 public function testIntType ()
121121 {
122- trace_metrics ()->count ('test-count ' , 2 , ['foo ' => 'bar ' ]);
123- trace_metrics ()->flush ();
122+ traceMetrics ()->count ('test-count ' , 2 , ['foo ' => 'bar ' ]);
123+ traceMetrics ()->flush ();
124124
125125 $ this ->assertCount (1 , StubTransport::$ events );
126126 $ event = StubTransport::$ events [0 ];
@@ -134,8 +134,8 @@ public function testIntType()
134134
135135 public function testFloatType (): void
136136 {
137- trace_metrics ()->gauge ('test-gauge ' , 10.50 , ['foo ' => 'bar ' ]);
138- trace_metrics ()->flush ();
137+ traceMetrics ()->gauge ('test-gauge ' , 10.50 , ['foo ' => 'bar ' ]);
138+ traceMetrics ()->flush ();
139139
140140 $ this ->assertCount (1 , StubTransport::$ events );
141141 $ event = StubTransport::$ events [0 ];
@@ -150,8 +150,8 @@ public function testFloatType(): void
150150 public function testInvalidTypeIsDiscarded (): void
151151 {
152152 // @phpstan-ignore-next-line
153- trace_metrics ()->count ('test-count ' , 'test-value ' );
154- trace_metrics ()->flush ();
153+ traceMetrics ()->count ('test-count ' , 'test-value ' );
154+ traceMetrics ()->flush ();
155155
156156 $ this ->assertEmpty (StubTransport::$ events );
157157 }
0 commit comments