@@ -106,21 +106,14 @@ impl ScrapeService {
106
106
107
107
async fn send_stats_event ( & self , original_peer_ip : IpAddr , server_socket_addr : SocketAddr ) {
108
108
if let Some ( http_stats_event_sender) = self . opt_http_stats_event_sender . as_deref ( ) {
109
- let event = match original_peer_ip {
110
- IpAddr :: V4 ( _ ) => statistics:: event:: Event :: Tcp4Scrape {
109
+ http_stats_event_sender
110
+ . send_event ( statistics:: event:: Event :: TcpScrape {
111
111
connection : ConnectionContext {
112
112
client_ip_addr : original_peer_ip,
113
113
server_socket_addr,
114
114
} ,
115
- } ,
116
- IpAddr :: V6 ( _) => statistics:: event:: Event :: Tcp6Scrape {
117
- connection : ConnectionContext {
118
- client_ip_addr : original_peer_ip,
119
- server_socket_addr,
120
- } ,
121
- } ,
122
- } ;
123
- http_stats_event_sender. send_event ( event) . await ;
115
+ } )
116
+ . await ;
124
117
}
125
118
}
126
119
}
@@ -342,7 +335,7 @@ mod tests {
342
335
let mut http_stats_event_sender_mock = MockHttpStatsEventSender :: new ( ) ;
343
336
http_stats_event_sender_mock
344
337
. expect_send_event ( )
345
- . with ( eq ( statistics:: event:: Event :: Tcp4Scrape {
338
+ . with ( eq ( statistics:: event:: Event :: TcpScrape {
346
339
connection : ConnectionContext {
347
340
client_ip_addr : IpAddr :: V4 ( Ipv4Addr :: new ( 126 , 0 , 0 , 1 ) ) ,
348
341
server_socket_addr : SocketAddr :: new ( IpAddr :: V4 ( Ipv4Addr :: new ( 127 , 0 , 0 , 1 ) ) , 7070 ) ,
@@ -390,7 +383,7 @@ mod tests {
390
383
let mut http_stats_event_sender_mock = MockHttpStatsEventSender :: new ( ) ;
391
384
http_stats_event_sender_mock
392
385
. expect_send_event ( )
393
- . with ( eq ( statistics:: event:: Event :: Tcp6Scrape {
386
+ . with ( eq ( statistics:: event:: Event :: TcpScrape {
394
387
connection : ConnectionContext {
395
388
client_ip_addr : IpAddr :: V6 ( Ipv6Addr :: new ( 0x6969 , 0x6969 , 0x6969 , 0x6969 , 0x6969 , 0x6969 , 0x6969 , 0x6969 ) ) ,
396
389
server_socket_addr,
@@ -510,7 +503,7 @@ mod tests {
510
503
let mut http_stats_event_sender_mock = MockHttpStatsEventSender :: new ( ) ;
511
504
http_stats_event_sender_mock
512
505
. expect_send_event ( )
513
- . with ( eq ( statistics:: event:: Event :: Tcp4Scrape {
506
+ . with ( eq ( statistics:: event:: Event :: TcpScrape {
514
507
connection : ConnectionContext {
515
508
client_ip_addr : IpAddr :: V4 ( Ipv4Addr :: new ( 126 , 0 , 0 , 1 ) ) ,
516
509
server_socket_addr : SocketAddr :: new ( IpAddr :: V4 ( Ipv4Addr :: new ( 127 , 0 , 0 , 1 ) ) , 7070 ) ,
@@ -558,7 +551,7 @@ mod tests {
558
551
let mut http_stats_event_sender_mock = MockHttpStatsEventSender :: new ( ) ;
559
552
http_stats_event_sender_mock
560
553
. expect_send_event ( )
561
- . with ( eq ( statistics:: event:: Event :: Tcp6Scrape {
554
+ . with ( eq ( statistics:: event:: Event :: TcpScrape {
562
555
connection : ConnectionContext {
563
556
client_ip_addr : IpAddr :: V6 ( Ipv6Addr :: new ( 0x6969 , 0x6969 , 0x6969 , 0x6969 , 0x6969 , 0x6969 , 0x6969 , 0x6969 ) ) ,
564
557
server_socket_addr,
0 commit comments