@@ -277,10 +277,11 @@ async fn test_instance_watcher_metrics(
277
277
use oxql_types:: point:: ValueArray ;
278
278
let uuid = FieldValue :: Uuid ( instance_id. into_untyped_uuid ( ) ) ;
279
279
let state = FieldValue :: String ( state. into ( ) ) ;
280
- let mut timeserieses = table. timeseries ( ) . filter ( |ts| {
281
- ts. fields . get ( INSTANCE_ID_FIELD ) == Some ( & uuid)
282
- && ts. fields . get ( STATE_FIELD ) == Some ( & state)
283
- } ) ;
280
+ let mut timeserieses =
281
+ table. timeseries . clone ( ) . into_iter ( ) . filter ( |ts| {
282
+ ts. fields . get ( INSTANCE_ID_FIELD ) == Some ( & uuid)
283
+ && ts. fields . get ( STATE_FIELD ) == Some ( & state)
284
+ } ) ;
284
285
let timeseries = timeserieses. next ( ) . ok_or_else ( || {
285
286
MetricsNotYet :: new ( format ! (
286
287
"missing timeseries for instance {instance_id}, state {state}\n \
@@ -325,7 +326,7 @@ async fn test_instance_watcher_metrics(
325
326
. system_timeseries_query_until ( OXQL_QUERY , |metrics| {
326
327
let checks = metrics
327
328
. iter ( )
328
- . find ( |t| t. name ( ) == "virtual_machine:check" )
329
+ . find ( |t| t. name == "virtual_machine:check" )
329
330
. ok_or_else ( || {
330
331
MetricsNotYet :: new ( "missing virtual_machine:check" )
331
332
} ) ?;
@@ -348,7 +349,7 @@ async fn test_instance_watcher_metrics(
348
349
. system_timeseries_query_until ( OXQL_QUERY , |metrics| {
349
350
let checks = metrics
350
351
. iter ( )
351
- . find ( |t| t. name ( ) == "virtual_machine:check" )
352
+ . find ( |t| t. name == "virtual_machine:check" )
352
353
. expect ( "missing virtual_machine:check" ) ;
353
354
let ts1 =
354
355
dbg ! ( count_state( & checks, instance1_uuid, STATE_STARTING ) ?) ;
@@ -371,7 +372,7 @@ async fn test_instance_watcher_metrics(
371
372
. system_timeseries_query_until ( OXQL_QUERY , |metrics| {
372
373
let checks = metrics
373
374
. iter ( )
374
- . find ( |t| t. name ( ) == "virtual_machine:check" )
375
+ . find ( |t| t. name == "virtual_machine:check" )
375
376
. expect ( "missing virtual_machine:check" ) ;
376
377
let ts1_starting =
377
378
dbg ! ( count_state( & checks, instance1_uuid, STATE_STARTING ) ?) ;
@@ -402,7 +403,7 @@ async fn test_instance_watcher_metrics(
402
403
. system_timeseries_query_until ( OXQL_QUERY , |metrics| {
403
404
let checks = metrics
404
405
. iter ( )
405
- . find ( |t| t. name ( ) == "virtual_machine:check" )
406
+ . find ( |t| t. name == "virtual_machine:check" )
406
407
. expect ( "missing virtual_machine:check" ) ;
407
408
408
409
let ts1_starting =
@@ -437,7 +438,7 @@ async fn test_instance_watcher_metrics(
437
438
. system_timeseries_query_until ( OXQL_QUERY , |metrics| {
438
439
let checks = metrics
439
440
. iter ( )
440
- . find ( |t| t. name ( ) == "virtual_machine:check" )
441
+ . find ( |t| t. name == "virtual_machine:check" )
441
442
. expect ( "missing virtual_machine:check" ) ;
442
443
let ts1_starting =
443
444
dbg ! ( count_state( & checks, instance1_uuid, STATE_STARTING ) ?) ;
@@ -497,7 +498,7 @@ async fn test_project_timeseries_query(
497
498
return Err ( MetricsNotYet :: new ( "waiting for table creation" ) ) ;
498
499
}
499
500
assert_eq ! ( result. len( ) , 1 ) ;
500
- if result[ 0 ] . timeseries ( ) . len ( ) == 0 {
501
+ if result[ 0 ] . timeseries . is_empty ( ) {
501
502
return Err ( MetricsNotYet :: new (
502
503
"waiting for timeseries population" ,
503
504
) ) ;
@@ -511,23 +512,23 @@ async fn test_project_timeseries_query(
511
512
. project_timeseries_query ( & p1. identity . id . to_string ( ) , q1)
512
513
. await ;
513
514
assert_eq ! ( result. len( ) , 1 ) ;
514
- assert ! ( result[ 0 ] . timeseries( ) . len ( ) > 0 ) ;
515
+ assert ! ( ! result[ 0 ] . timeseries. is_empty ( ) ) ;
515
516
516
517
let result = metrics_querier. project_timeseries_query ( "project2" , q1) . await ;
517
518
assert_eq ! ( result. len( ) , 1 ) ;
518
- assert ! ( result[ 0 ] . timeseries( ) . len ( ) > 0 ) ;
519
+ assert ! ( ! result[ 0 ] . timeseries. is_empty ( ) ) ;
519
520
520
521
// with project specified
521
522
let q2 = & format ! ( "{} | filter project_id == \" {}\" " , q1, p1. identity. id) ;
522
523
523
524
let result = metrics_querier. project_timeseries_query ( "project1" , q2) . await ;
524
525
assert_eq ! ( result. len( ) , 1 ) ;
525
526
// we get 2 timeseries because there are two instances
526
- assert ! ( result[ 0 ] . timeseries( ) . len( ) == 2 ) ;
527
+ assert ! ( result[ 0 ] . timeseries. len( ) == 2 ) ;
527
528
528
529
let result = metrics_querier. project_timeseries_query ( "project2" , q2) . await ;
529
530
assert_eq ! ( result. len( ) , 1 ) ;
530
- assert_eq ! ( result[ 0 ] . timeseries( ) . len( ) , 0 ) ;
531
+ assert_eq ! ( result[ 0 ] . timeseries. len( ) , 0 ) ;
531
532
532
533
// with instance specified
533
534
let q3 =
@@ -536,12 +537,12 @@ async fn test_project_timeseries_query(
536
537
// project containing instance gives me something
537
538
let result = metrics_querier. project_timeseries_query ( "project1" , q3) . await ;
538
539
assert_eq ! ( result. len( ) , 1 ) ;
539
- assert_eq ! ( result[ 0 ] . timeseries( ) . len( ) , 1 ) ;
540
+ assert_eq ! ( result[ 0 ] . timeseries. len( ) , 1 ) ;
540
541
541
542
// should be empty or error
542
543
let result = metrics_querier. project_timeseries_query ( "project2" , q3) . await ;
543
544
assert_eq ! ( result. len( ) , 1 ) ;
544
- assert_eq ! ( result[ 0 ] . timeseries( ) . len( ) , 0 ) ;
545
+ assert_eq ! ( result[ 0 ] . timeseries. len( ) , 0 ) ;
545
546
546
547
// now let's test it with group_by
547
548
let q4 = & format ! (
@@ -550,7 +551,7 @@ async fn test_project_timeseries_query(
550
551
) ;
551
552
let result = metrics_querier. project_timeseries_query ( "project1" , q4) . await ;
552
553
assert_eq ! ( result. len( ) , 1 ) ;
553
- assert_eq ! ( result[ 0 ] . timeseries( ) . len( ) , 2 ) ;
554
+ assert_eq ! ( result[ 0 ] . timeseries. len( ) , 2 ) ;
554
555
555
556
// test with a nested query
556
557
let q5 = & format ! (
@@ -565,13 +566,13 @@ async fn test_project_timeseries_query(
565
566
// we get two results, each contains one timeseries, and the instance ID
566
567
// on each corresponds to the one we requested
567
568
assert_eq ! ( result. len( ) , 2 ) ;
568
- assert_eq ! ( result[ 0 ] . timeseries( ) . len( ) , 1 ) ;
569
- let timeseries = result[ 0 ] . timeseries ( ) . next ( ) . unwrap ( ) ;
569
+ assert_eq ! ( result[ 0 ] . timeseries. len( ) , 1 ) ;
570
+ let timeseries = result[ 0 ] . timeseries [ 0 ] . clone ( ) ;
570
571
let instance_id = timeseries. fields . get ( "instance_id" ) . unwrap ( ) . to_string ( ) ;
571
572
assert_eq ! ( instance_id, i1p1. identity. id. to_string( ) ) ;
572
573
573
- assert_eq ! ( result[ 1 ] . timeseries( ) . len( ) , 1 ) ;
574
- let timeseries = result[ 1 ] . timeseries ( ) . next ( ) . unwrap ( ) ;
574
+ assert_eq ! ( result[ 1 ] . timeseries. len( ) , 1 ) ;
575
+ let timeseries = & result[ 1 ] . timeseries [ 0 ] ;
575
576
let instance_id = timeseries. fields . get ( "instance_id" ) . unwrap ( ) . to_string ( ) ;
576
577
assert_eq ! ( instance_id, i2p1. identity. id. to_string( ) ) ;
577
578
@@ -642,7 +643,7 @@ async fn test_project_timeseries_query(
642
643
. execute_and_parse_unwrap :: < views:: OxqlQueryResult > ( )
643
644
. await ;
644
645
assert_eq ! ( result. tables. len( ) , 1 ) ;
645
- assert_eq ! ( result. tables[ 0 ] . timeseries( ) . len( ) , 2 ) ; // two instances
646
+ assert_eq ! ( result. tables[ 0 ] . timeseries. len( ) , 2 ) ; // two instances
646
647
}
647
648
648
649
#[ nexus_test]
@@ -780,7 +781,7 @@ async fn test_mgs_metrics(
780
781
querier. system_timeseries_query_until ( & query, |tables| {
781
782
let table = tables
782
783
. into_iter ( )
783
- . find ( |t| t. name ( ) == name)
784
+ . find ( |t| t. name == * name)
784
785
. ok_or_else ( || {
785
786
MetricsNotYet :: new ( format ! (
786
787
"failed to find table for {query}" ,
@@ -791,7 +792,7 @@ async fn test_mgs_metrics(
791
792
. keys ( )
792
793
. map ( |serial| ( serial. clone ( ) , 0 ) )
793
794
. collect :: < HashMap < _ , usize > > ( ) ;
794
- for timeseries in table. timeseries ( ) {
795
+ for timeseries in & table. timeseries {
795
796
let fields = & timeseries. fields ;
796
797
if timeseries. points . is_empty ( ) {
797
798
return Err ( MetricsNotYet :: new ( format ! (
0 commit comments