@@ -84,7 +84,7 @@ public class OpenTelemetryBuiltInMetricsTracerTest extends AbstractNettyMockServ
8484      Attributes .builder ().put (BuiltInMetricsConstant .DIRECT_PATH_USED_KEY , "false" ).build ();
8585  ;
8686
87-   private  static  final  long  MIN_LATENCY  = 0 ;
87+   private  static  final  double  MIN_LATENCY  = 0 ;
8888
8989  private  DatabaseClient  client ;
9090
@@ -159,7 +159,7 @@ public void testMetricsSingleUseQuery() {
159159      assertFalse (resultSet .next ());
160160    }
161161
162-     long  elapsed  = stopwatch .elapsed (TimeUnit .MILLISECONDS );
162+     double  elapsed  = stopwatch .elapsed (TimeUnit .MILLISECONDS );
163163    Attributes  expectedAttributes  =
164164        expectedCommonBaseAttributes .toBuilder ()
165165            .putAll (expectedCommonRequestAttributes )
@@ -170,13 +170,14 @@ public void testMetricsSingleUseQuery() {
170170    MetricData  operationLatencyMetricData  =
171171        getMetricData (metricReader , BuiltInMetricsConstant .OPERATION_LATENCIES_NAME );
172172    assertNotNull (operationLatencyMetricData );
173-     long  operationLatencyValue  = getAggregatedValue (operationLatencyMetricData , expectedAttributes );
173+     double  operationLatencyValue  =
174+         getAggregatedValue (operationLatencyMetricData , expectedAttributes );
174175    assertThat (operationLatencyValue ).isIn (Range .closed (MIN_LATENCY , elapsed ));
175176
176177    MetricData  attemptLatencyMetricData  =
177178        getMetricData (metricReader , BuiltInMetricsConstant .ATTEMPT_LATENCIES_NAME );
178179    assertNotNull (attemptLatencyMetricData );
179-     long  attemptLatencyValue  = getAggregatedValue (attemptLatencyMetricData , expectedAttributes );
180+     double  attemptLatencyValue  = getAggregatedValue (attemptLatencyMetricData , expectedAttributes );
180181    assertThat (attemptLatencyValue ).isIn (Range .closed (MIN_LATENCY , elapsed ));
181182
182183    MetricData  operationCountMetricData  =
@@ -191,7 +192,7 @@ public void testMetricsSingleUseQuery() {
191192
192193    MetricData  gfeLatencyMetricData  =
193194        getMetricData (metricReader , BuiltInMetricsConstant .GFE_LATENCIES_NAME );
194-     long  gfeLatencyValue  = getAggregatedValue (gfeLatencyMetricData , expectedAttributes );
195+     double  gfeLatencyValue  = getAggregatedValue (gfeLatencyMetricData , expectedAttributes );
195196    assertEquals (fakeServerTiming .get (), gfeLatencyValue , 0 );
196197
197198    assertFalse (
@@ -229,7 +230,7 @@ public void testMetricsSingleUseQueryWithAfeEnabled() throws Exception {
229230        assertFalse (resultSet .next ());
230231      }
231232
232-       long  elapsed  = stopwatch .elapsed (TimeUnit .MILLISECONDS );
233+       double  elapsed  = stopwatch .elapsed (TimeUnit .MILLISECONDS );
233234      Attributes  expectedAttributes  =
234235          expectedCommonBaseAttributes .toBuilder ()
235236              .putAll (expectedCommonRequestAttributes )
@@ -240,14 +241,14 @@ public void testMetricsSingleUseQueryWithAfeEnabled() throws Exception {
240241      MetricData  operationLatencyMetricData  =
241242          getMetricData (metricReader , BuiltInMetricsConstant .OPERATION_LATENCIES_NAME );
242243      assertNotNull (operationLatencyMetricData );
243-       long  operationLatencyValue  =
244+       double  operationLatencyValue  =
244245          getAggregatedValue (operationLatencyMetricData , expectedAttributes );
245246      assertThat (operationLatencyValue ).isIn (Range .closed (MIN_LATENCY , elapsed ));
246247
247248      MetricData  attemptLatencyMetricData  =
248249          getMetricData (metricReader , BuiltInMetricsConstant .ATTEMPT_LATENCIES_NAME );
249250      assertNotNull (attemptLatencyMetricData );
250-       long  attemptLatencyValue  = getAggregatedValue (attemptLatencyMetricData , expectedAttributes );
251+       double  attemptLatencyValue  = getAggregatedValue (attemptLatencyMetricData , expectedAttributes );
251252      assertThat (attemptLatencyValue ).isIn (Range .closed (MIN_LATENCY , elapsed ));
252253
253254      MetricData  operationCountMetricData  =
@@ -262,15 +263,15 @@ public void testMetricsSingleUseQueryWithAfeEnabled() throws Exception {
262263
263264      MetricData  gfeLatencyMetricData  =
264265          getMetricData (metricReader , BuiltInMetricsConstant .GFE_LATENCIES_NAME );
265-       long  gfeLatencyValue  = getAggregatedValue (gfeLatencyMetricData , expectedAttributes );
266+       double  gfeLatencyValue  = getAggregatedValue (gfeLatencyMetricData , expectedAttributes );
266267      assertEquals (fakeServerTiming .get (), gfeLatencyValue , 0 );
267268
268269      assertFalse (
269270          checkIfMetricExists (metricReader , BuiltInMetricsConstant .GFE_CONNECTIVITY_ERROR_NAME ));
270271
271272      MetricData  afeLatencyMetricData  =
272273          getMetricData (metricReader , BuiltInMetricsConstant .AFE_LATENCIES_NAME );
273-       long  afeLatencyValue  = getAggregatedValue (afeLatencyMetricData , expectedAttributes );
274+       double  afeLatencyValue  = getAggregatedValue (afeLatencyMetricData , expectedAttributes );
274275      assertEquals (fakeAFEServerTiming .get (), afeLatencyValue , 0 );
275276      assertFalse (
276277          checkIfMetricExists (metricReader , BuiltInMetricsConstant .AFE_CONNECTIVITY_ERROR_NAME ));
@@ -402,7 +403,7 @@ public void testNoNetworkConnection() {
402403
403404    // Attempt count should have a failed metric point for CreateSession. 
404405    assertEquals (
405-         1 , getAggregatedValue (attemptCountMetricData , expectedAttributesCreateSessionFailed ));
406+         1 , getAggregatedValue (attemptCountMetricData , expectedAttributesCreateSessionFailed ),  0 );
406407  }
407408
408409  @ Test 
@@ -509,14 +510,14 @@ private boolean checkIfMetricExists(InMemoryMetricReader reader, String metricNa
509510    return  false ;
510511  }
511512
512-   private  long  getAggregatedValue (MetricData  metricData , Attributes  attributes ) {
513+   private  float  getAggregatedValue (MetricData  metricData , Attributes  attributes ) {
513514    switch  (metricData .getType ()) {
514515      case  HISTOGRAM :
515516        return  metricData .getHistogramData ().getPoints ().stream ()
516517            .filter (pd  -> pd .getAttributes ().equals (attributes ))
517-             .map (data  -> (long ) data .getSum () / data .getCount ())
518+             .map (data  -> (float ) data .getSum () / data .getCount ())
518519            .findFirst ()
519-             .orElse (0L );
520+             .orElse (0F );
520521      case  LONG_SUM :
521522        return  metricData .getLongSumData ().getPoints ().stream ()
522523            .filter (pd  -> pd .getAttributes ().equals (attributes ))
0 commit comments