1414use Sentry \Options ;
1515use Sentry \State \HubAdapter ;
1616
17- use function Sentry \traceMetrics ;
17+ use function Sentry \metrics ;
1818
1919final class TraceMetricsTest extends TestCase
2020{
@@ -26,9 +26,9 @@ protected function setUp(): void
2626
2727 public function testCounterMetrics (): void
2828 {
29- traceMetrics ()->count ('test-count ' , 2 , ['foo ' => 'bar ' ]);
30- traceMetrics ()->count ('test-count ' , 2 , ['foo ' => 'bar ' ]);
31- traceMetrics ()->flush ();
29+ metrics ()->count ('test-count ' , 2 , ['foo ' => 'bar ' ]);
30+ metrics ()->count ('test-count ' , 2 , ['foo ' => 'bar ' ]);
31+ metrics ()->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- traceMetrics ()->gauge ('test-gauge ' , 10 , ['foo ' => 'bar ' ]);
47- traceMetrics ()->flush ();
46+ metrics ()->gauge ('test-gauge ' , 10 , ['foo ' => 'bar ' ]);
47+ metrics ()->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- traceMetrics ()->distribution ('test-distribution ' , 10 , ['foo ' => 'bar ' ]);
63- traceMetrics ()->flush ();
62+ metrics ()->distribution ('test-distribution ' , 10 , ['foo ' => 'bar ' ]);
63+ metrics ()->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- traceMetrics ()->count ('test ' , 1 , ['foo ' => 'bar ' ]);
78+ metrics ()->count ('test ' , 1 , ['foo ' => 'bar ' ]);
7979 }
80- traceMetrics ()->flush ();
80+ metrics ()->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- traceMetrics ()->count ('test-count ' , 2 , ['foo ' => 'bar ' ]);
94- traceMetrics ()->flush ();
93+ metrics ()->count ('test-count ' , 2 , ['foo ' => 'bar ' ]);
94+ metrics ()->flush ();
9595
9696 $ this ->assertEmpty (StubTransport::$ events );
9797 }
@@ -106,8 +106,8 @@ public function testBeforeSendMetricAltersContent()
106106 },
107107 ]), StubTransport::getInstance ()));
108108
109- traceMetrics ()->count ('test-count ' , 2 , ['foo ' => 'bar ' ]);
110- traceMetrics ()->flush ();
109+ metrics ()->count ('test-count ' , 2 , ['foo ' => 'bar ' ]);
110+ metrics ()->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- traceMetrics ()->count ('test-count ' , 2 , ['foo ' => 'bar ' ]);
123- traceMetrics ()->flush ();
122+ metrics ()->count ('test-count ' , 2 , ['foo ' => 'bar ' ]);
123+ metrics ()->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- traceMetrics ()->gauge ('test-gauge ' , 10.50 , ['foo ' => 'bar ' ]);
138- traceMetrics ()->flush ();
137+ metrics ()->gauge ('test-gauge ' , 10.50 , ['foo ' => 'bar ' ]);
138+ metrics ()->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- traceMetrics ()->count ('test-count ' , 'test-value ' );
154- traceMetrics ()->flush ();
153+ metrics ()->count ('test-count ' , 'test-value ' );
154+ metrics ()->flush ();
155155
156156 $ this ->assertEmpty (StubTransport::$ events );
157157 }
0 commit comments