@@ -288,7 +288,8 @@ async fn run_io_loop<B>(
288288
289289 // Listen for transactions to forward, and send a copy of each one to the matching endpoint I/O tasks.
290290 while let Some ( transaction) = transactions_rx. recv ( ) . await {
291- let is_metrics_request = is_metrics_request_uri ( transaction. request_uri ( ) ) ;
291+ let is_metrics_request =
292+ is_metrics_request_uri ( transaction. request_uri ( ) , config. v3_api ( ) . series . beta_route . as_str ( ) ) ;
292293 for endpoint_sender in & endpoint_txs {
293294 if !should_route_to_endpoint ( is_metrics_request, has_metrics_primary, endpoint_sender. route ) {
294295 continue ;
@@ -332,8 +333,8 @@ where
332333 tx : mpsc:: Sender < Transaction < B > > ,
333334}
334335
335- fn is_metrics_request_uri ( uri : & Uri ) -> bool {
336- METRIC_INTAKE_PATHS . contains ( & uri. path ( ) )
336+ fn is_metrics_request_uri ( uri : & Uri , v3_beta_series_route : & str ) -> bool {
337+ METRIC_INTAKE_PATHS . contains ( & uri. path ( ) ) || uri . path ( ) == v3_beta_series_route
337338}
338339
339340fn should_route_to_endpoint ( is_metrics_request : bool , has_metrics_primary : bool , route : EndpointRoute ) -> bool {
@@ -888,23 +889,45 @@ mod tests {
888889
889890 use super :: * ;
890891 use crate :: common:: datadog:: transaction:: { Metadata as TxnMetadata , Transaction } ;
891- use crate :: common:: datadog:: { METRICS_SERIES_V1_PATH , METRICS_SERIES_V2_PATH , METRICS_SKETCHES_PATH } ;
892+ use crate :: common:: datadog:: {
893+ METRICS_SERIES_V1_PATH , METRICS_SERIES_V2_PATH , METRICS_SERIES_V3_BETA_PATH , METRICS_SERIES_V3_PATH ,
894+ METRICS_SKETCHES_PATH , METRICS_SKETCHES_V3_PATH ,
895+ } ;
892896
893897 fn uri ( path : & ' static str ) -> Uri {
894898 Uri :: from_static ( path)
895899 }
896900
901+ fn is_metrics_request_path ( path : & ' static str ) -> bool {
902+ is_metrics_request_uri ( & uri ( path) , METRICS_SERIES_V3_BETA_PATH )
903+ }
904+
897905 fn forwarder_config_from_value ( value : serde_json:: Value ) -> ForwarderConfiguration {
898906 serde_json:: from_value ( value) . expect ( "ForwarderConfiguration should deserialize" )
899907 }
900908
901909 #[ test]
902910 fn identifies_metrics_request_paths ( ) {
903- assert ! ( is_metrics_request_uri( & uri( METRICS_SERIES_V1_PATH ) ) ) ;
904- assert ! ( is_metrics_request_uri( & uri( METRICS_SERIES_V2_PATH ) ) ) ;
905- assert ! ( is_metrics_request_uri( & uri( METRICS_SKETCHES_PATH ) ) ) ;
906- assert ! ( !is_metrics_request_uri( & uri( "/api/v2/logs" ) ) ) ;
907- assert ! ( !is_metrics_request_uri( & uri( "/api/v0.2/traces" ) ) ) ;
911+ assert ! ( is_metrics_request_path( METRICS_SERIES_V1_PATH ) ) ;
912+ assert ! ( is_metrics_request_path( METRICS_SERIES_V2_PATH ) ) ;
913+ assert ! ( is_metrics_request_path( METRICS_SERIES_V3_PATH ) ) ;
914+ assert ! ( is_metrics_request_path( METRICS_SERIES_V3_BETA_PATH ) ) ;
915+ assert ! ( is_metrics_request_path( METRICS_SKETCHES_PATH ) ) ;
916+ assert ! ( is_metrics_request_path( METRICS_SKETCHES_V3_PATH ) ) ;
917+ assert ! ( !is_metrics_request_path( "/api/v2/logs" ) ) ;
918+ assert ! ( !is_metrics_request_path( "/api/v0.2/traces" ) ) ;
919+ }
920+
921+ #[ test]
922+ fn identifies_configured_v3_beta_series_route_as_metrics_path ( ) {
923+ assert ! ( is_metrics_request_uri(
924+ & uri( "/custom/v3beta/series" ) ,
925+ "/custom/v3beta/series"
926+ ) ) ;
927+ assert ! ( !is_metrics_request_uri(
928+ & uri( "/custom/v3beta/series" ) ,
929+ METRICS_SERIES_V3_BETA_PATH
930+ ) ) ;
908931 }
909932
910933 #[ test]
0 commit comments