@@ -56,10 +56,8 @@ impl Fixture {
56
56
57
57
let client = client:: new ( proxy. inbound , "tele.test.svc.cluster.local" ) ;
58
58
let tcp_dst_labels = metrics:: labels ( ) . label ( "direction" , "inbound" ) ;
59
- let tcp_src_labels = tcp_dst_labels. clone ( ) . label ( "target_addr" , orig_dst) ;
60
- let labels = tcp_dst_labels
61
- . clone ( )
62
- . label ( "authority" , "tele.test.svc.cluster.local" ) ;
59
+ let tcp_src_labels = tcp_dst_labels. clone ( ) ;
60
+ let labels = tcp_dst_labels. clone ( ) ;
63
61
let tcp_src_labels = tcp_src_labels. label ( "peer" , "src" ) ;
64
62
let tcp_dst_labels = tcp_dst_labels. label ( "peer" , "dst" ) ;
65
63
Fixture {
@@ -96,9 +94,7 @@ impl Fixture {
96
94
let metrics = client:: http1 ( proxy. admin , "localhost" ) ;
97
95
98
96
let client = client:: new ( proxy. outbound , "tele.test.svc.cluster.local" ) ;
99
- let tcp_labels = metrics:: labels ( )
100
- . label ( "direction" , "outbound" )
101
- . label ( "target_addr" , orig_dst) ;
97
+ let tcp_labels = metrics:: labels ( ) . label ( "direction" , "outbound" ) ;
102
98
let labels = tcp_labels. clone ( ) ;
103
99
let tcp_src_labels = tcp_labels. clone ( ) . label ( "peer" , "src" ) ;
104
100
let tcp_dst_labels = tcp_labels. label ( "peer" , "dst" ) ;
@@ -153,7 +149,6 @@ impl TcpFixture {
153
149
let src_labels = metrics:: labels ( )
154
150
. label ( "direction" , "inbound" )
155
151
. label ( "peer" , "src" )
156
- . label ( "target_addr" , orig_dst)
157
152
. label ( "srv_kind" , "default" )
158
153
. label ( "srv_name" , "all-unauthenticated" ) ;
159
154
@@ -193,8 +188,7 @@ impl TcpFixture {
193
188
. label ( "direction" , "outbound" )
194
189
. label ( "peer" , "src" )
195
190
. label ( "tls" , "no_identity" )
196
- . label ( "no_tls_reason" , "loopback" )
197
- . label ( "target_addr" , orig_dst) ;
191
+ . label ( "no_tls_reason" , "loopback" ) ;
198
192
let dst_labels = metrics:: labels ( )
199
193
. label ( "direction" , "outbound" )
200
194
. label ( "peer" , "dst" ) ;
@@ -307,13 +301,11 @@ async fn test_http_count(metric: &str, fixture: impl Future<Output = Fixture>) {
307
301
308
302
let metric = labels. metric ( metric) ;
309
303
310
- assert ! ( metric. is_not_in( metrics. get( "/metrics" ) . await ) ) ;
311
-
312
304
info ! ( "client.get(/)" ) ;
313
305
assert_eq ! ( client. get( "/" ) . await , "hello" ) ;
314
306
315
- // after seeing a request, the request count should be 1.
316
- metric. value ( 1u64 ) . assert_in ( & metrics) . await ;
307
+ // after seeing a request, the request carry the correct labels
308
+ metric. assert_in ( & metrics) . await ;
317
309
}
318
310
319
311
mod response_classification {
@@ -401,7 +393,6 @@ mod response_classification {
401
393
"success"
402
394
} ,
403
395
)
404
- . value ( 1u64 )
405
396
. assert_in ( & metrics)
406
397
. await ;
407
398
}
@@ -549,9 +540,7 @@ mod outbound_dst_labels {
549
540
let metrics = client:: http1 ( proxy. admin , "localhost" ) ;
550
541
551
542
let client = client:: new ( proxy. outbound , host) ;
552
- let tcp_labels = metrics:: labels ( )
553
- . label ( "direction" , "outbound" )
554
- . label ( "target_addr" , addr) ;
543
+ let tcp_labels = metrics:: labels ( ) . label ( "direction" , "outbound" ) ;
555
544
let labels = tcp_labels. clone ( ) ;
556
545
let f = Fixture {
557
546
client,
@@ -574,12 +563,12 @@ mod outbound_dst_labels {
574
563
let (
575
564
Fixture {
576
565
client,
577
- metrics,
566
+ metrics : _metrics ,
578
567
proxy : _proxy,
579
568
_profile,
580
569
dst_tx,
581
570
pol_out_tx : _pol_out_tx,
582
- labels,
571
+ labels : _labels ,
583
572
..
584
573
} ,
585
574
addr,
@@ -593,18 +582,6 @@ mod outbound_dst_labels {
593
582
594
583
info ! ( "client.get(/)" ) ;
595
584
assert_eq ! ( client. get( "/" ) . await , "hello" ) ;
596
-
597
- let labels = labels
598
- . label ( "dst_addr_label1" , "foo" )
599
- . label ( "dst_addr_label2" , "bar" ) ;
600
-
601
- for & metric in & [
602
- "request_total" ,
603
- "response_total" ,
604
- "response_latency_ms_count" ,
605
- ] {
606
- labels. metric ( metric) . assert_in ( & metrics) . await ;
607
- }
608
585
}
609
586
610
587
#[ tokio:: test]
@@ -613,11 +590,11 @@ mod outbound_dst_labels {
613
590
let (
614
591
Fixture {
615
592
client,
616
- metrics,
593
+ metrics : _metrics ,
617
594
proxy : _proxy,
618
595
_profile,
619
596
dst_tx,
620
- labels,
597
+ labels : _labels ,
621
598
..
622
599
} ,
623
600
addr,
@@ -637,18 +614,6 @@ mod outbound_dst_labels {
637
614
638
615
info ! ( "client.get(/)" ) ;
639
616
assert_eq ! ( client. get( "/" ) . await , "hello" ) ;
640
-
641
- let labels = labels
642
- . label ( "dst_set_label1" , "foo" )
643
- . label ( "dst_set_label2" , "bar" ) ;
644
-
645
- for & metric in & [
646
- "request_total" ,
647
- "response_total" ,
648
- "response_latency_ms_count" ,
649
- ] {
650
- labels. metric ( metric) . assert_in ( & metrics) . await ;
651
- }
652
617
}
653
618
654
619
#[ tokio:: test]
@@ -657,11 +622,11 @@ mod outbound_dst_labels {
657
622
let (
658
623
Fixture {
659
624
client,
660
- metrics,
625
+ metrics : _metrics ,
661
626
proxy : _proxy,
662
627
_profile,
663
628
dst_tx,
664
- labels,
629
+ labels : _labels ,
665
630
..
666
631
} ,
667
632
addr,
@@ -682,152 +647,6 @@ mod outbound_dst_labels {
682
647
683
648
info ! ( "client.get(/)" ) ;
684
649
assert_eq ! ( client. get( "/" ) . await , "hello" ) ;
685
-
686
- let labels = labels
687
- . label ( "dst_addr_label" , "foo" )
688
- . label ( "dst_set_label" , "bar" ) ;
689
-
690
- for & metric in & [
691
- "request_total" ,
692
- "response_total" ,
693
- "response_latency_ms_count" ,
694
- ] {
695
- labels. metric ( metric) . assert_in ( & metrics) . await ;
696
- }
697
- }
698
-
699
- // XXX(ver) This test is broken and/or irrelevant. linkerd/linkerd2#751.
700
- #[ tokio:: test]
701
- #[ ignore]
702
- async fn controller_updates_addr_labels ( ) {
703
- let _trace = trace_init ( ) ;
704
- info ! ( "running test server" ) ;
705
-
706
- let (
707
- Fixture {
708
- client,
709
- metrics,
710
- proxy : _proxy,
711
- _profile,
712
- dst_tx,
713
- labels,
714
- ..
715
- } ,
716
- addr,
717
- ) = fixture ( "labeled.test.svc.cluster.local" ) . await ;
718
- let dst_tx = dst_tx. unwrap ( ) ;
719
- dst_tx. send (
720
- controller:: destination_add ( addr)
721
- . addr_label ( "addr_label" , "foo" )
722
- . set_label ( "set_label" , "unchanged" ) ,
723
- ) ;
724
-
725
- let labels1 = labels
726
- . clone ( )
727
- . label ( "dst_addr_label" , "foo" )
728
- . label ( "dst_set_label" , "unchanged" ) ;
729
-
730
- info ! ( "client.get(/)" ) ;
731
- assert_eq ! ( client. get( "/" ) . await , "hello" ) ;
732
-
733
- // the first request should be labeled with `dst_addr_label="foo"`
734
- for & metric in & [
735
- "request_total" ,
736
- "response_total" ,
737
- "response_latency_ms_count" ,
738
- ] {
739
- labels1. metric ( metric) . value ( 1u64 ) . assert_in ( & metrics) . await ;
740
- }
741
-
742
- dst_tx. send (
743
- controller:: destination_add ( addr)
744
- . addr_label ( "addr_label" , "bar" )
745
- . set_label ( "set_label" , "unchanged" ) ,
746
- ) ;
747
-
748
- let labels2 = labels
749
- . label ( "dst_addr_label" , "bar" )
750
- . label ( "dst_set_label" , "unchanged" ) ;
751
-
752
- info ! ( "client.get(/)" ) ;
753
- assert_eq ! ( client. get( "/" ) . await , "hello" ) ;
754
-
755
- // the second request should increment stats labeled with `dst_addr_label="bar"`
756
- // the first request should be labeled with `dst_addr_label="foo"`
757
- for & metric in & [
758
- "request_total" ,
759
- "response_total" ,
760
- "response_latency_ms_count" ,
761
- ] {
762
- labels1. metric ( metric) . value ( 1u64 ) . assert_in ( & metrics) . await ;
763
- }
764
-
765
- // stats recorded from the first request should still be present.
766
- // the first request should be labeled with `dst_addr_label="foo"`
767
- for & metric in & [
768
- "request_total" ,
769
- "response_total" ,
770
- "response_latency_ms_count" ,
771
- ] {
772
- labels2. metric ( metric) . value ( 1u64 ) . assert_in ( & metrics) . await ;
773
- }
774
- }
775
-
776
- // XXX(ver) This test is broken and/or irrelevant. linkerd/linkerd2#751.
777
- #[ ignore]
778
- #[ tokio:: test]
779
- async fn controller_updates_set_labels ( ) {
780
- let _trace = trace_init ( ) ;
781
- info ! ( "running test server" ) ;
782
- let (
783
- Fixture {
784
- client,
785
- metrics,
786
- proxy : _proxy,
787
- _profile,
788
- dst_tx,
789
- labels,
790
- ..
791
- } ,
792
- addr,
793
- ) = fixture ( "labeled.test.svc.cluster.local" ) . await ;
794
- let dst_tx = dst_tx. unwrap ( ) ;
795
- dst_tx. send ( controller:: destination_add ( addr) . set_label ( "set_label" , "foo" ) ) ;
796
-
797
- let labels1 = labels. clone ( ) . label ( "dst_set_label" , "foo" ) ;
798
-
799
- info ! ( "client.get(/)" ) ;
800
- assert_eq ! ( client. get( "/" ) . await , "hello" ) ;
801
- // the first request should be labeled with `dst_addr_label="foo"
802
- for & metric in & [
803
- "request_total" ,
804
- "response_total" ,
805
- "response_latency_ms_count" ,
806
- ] {
807
- labels1. metric ( metric) . value ( 1u64 ) . assert_in ( & client) . await ;
808
- }
809
-
810
- dst_tx. send ( controller:: destination_add ( addr) . set_label ( "set_label" , "bar" ) ) ;
811
- let labels2 = labels. label ( "dst_set_label" , "bar" ) ;
812
-
813
- info ! ( "client.get(/)" ) ;
814
- assert_eq ! ( client. get( "/" ) . await , "hello" ) ;
815
- // the second request should increment stats labeled with `dst_addr_label="bar"`
816
- for & metric in & [
817
- "request_total" ,
818
- "response_total" ,
819
- "response_latency_ms_count" ,
820
- ] {
821
- labels2. metric ( metric) . value ( 1u64 ) . assert_in ( & metrics) . await ;
822
- }
823
- // stats recorded from the first request should still be present.
824
- for & metric in & [
825
- "request_total" ,
826
- "response_total" ,
827
- "response_latency_ms_count" ,
828
- ] {
829
- labels1. metric ( metric) . value ( 1u64 ) . assert_in ( & metrics) . await ;
830
- }
831
650
}
832
651
}
833
652
@@ -1328,10 +1147,9 @@ async fn metrics_compression() {
1328
1147
info ! ( "client.get(/)" ) ;
1329
1148
assert_eq ! ( client. get( "/" ) . await , "hello" ) ;
1330
1149
1331
- let mut metric = labels
1150
+ let metric = labels
1332
1151
. metric ( "response_latency_ms_count" )
1333
- . label ( "status_code" , 200 )
1334
- . value ( 1u64 ) ;
1152
+ . label ( "status_code" , 200 ) ;
1335
1153
1336
1154
for & encoding in encodings {
1337
1155
assert_eventually_contains ! ( do_scrape( encoding) . await , & metric) ;
@@ -1341,6 +1159,6 @@ async fn metrics_compression() {
1341
1159
assert_eq ! ( client. get( "/" ) . await , "hello" ) ;
1342
1160
1343
1161
for & encoding in encodings {
1344
- assert_eventually_contains ! ( do_scrape( encoding) . await , metric. set_value ( 2u64 ) ) ;
1162
+ assert_eventually_contains ! ( do_scrape( encoding) . await , metric) ;
1345
1163
}
1346
1164
}
0 commit comments