File tree Expand file tree Collapse file tree 3 files changed +10
-3
lines changed
datadog-serverless-compat/src Expand file tree Collapse file tree 3 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ const AGENT_HOST: &str = "0.0.0.0";
4646
4747#[ tokio:: main]
4848pub async fn main ( ) {
49- info ! ( "Stats test - buffer length: 90, bucket duration: 10" ) ;
49+ info ! ( "Stats test - buffer length: configurable / default 90, bucket duration: 10" ) ;
5050
5151 let log_level = env:: var ( "DD_LOG_LEVEL" )
5252 . map ( |val| val. to_lowercase ( ) )
Original file line number Diff line number Diff line change @@ -84,6 +84,8 @@ pub struct Config {
8484 pub stats_flush_interval : u64 ,
8585 /// how often to flush traces, in seconds
8686 pub trace_flush_interval : u64 ,
87+ /// buffer length for span concentrator
88+ pub stats_buffer_length : usize ,
8789 pub trace_intake : Endpoint ,
8890 pub trace_stats_intake : Endpoint ,
8991 /// timeout for environment verification, in milliseconds
@@ -131,6 +133,11 @@ impl Config {
131133 Tags :: new ( )
132134 } ;
133135
136+ let stats_buffer_length: usize = env:: var ( "DD_STATS_BUFFER_LENGTH" )
137+ . ok ( )
138+ . and_then ( |val| val. parse :: < usize > ( ) . ok ( ) )
139+ . unwrap_or ( 90 ) ;
140+
134141 #[ allow( clippy:: unwrap_used) ]
135142 Ok ( Config {
136143 app_name : Some ( app_name) ,
@@ -157,6 +164,7 @@ impl Config {
157164 . or_else ( |_| env:: var ( "HTTPS_PROXY" ) )
158165 . ok ( ) ,
159166 tags,
167+ stats_buffer_length,
160168 } )
161169 }
162170}
Original file line number Diff line number Diff line change @@ -10,7 +10,6 @@ use tracing::error;
1010
1111const S_TO_NS : u64 = 1_000_000_000 ;
1212const BUCKET_DURATION_NS : u64 = 10 * S_TO_NS ; // 10 seconds
13- const BUFFER_LENGTH : usize = 90 ;
1413
1514#[ derive( Debug , thiserror:: Error ) ]
1615pub enum StatsError {
@@ -119,7 +118,7 @@ impl StatsConcentratorService {
119118 SystemTime :: now ( ) ,
120119 vec ! [ ] ,
121120 vec ! [ ] ,
122- BUFFER_LENGTH ,
121+ config . stats_buffer_length ,
123122 ) ;
124123 let service: StatsConcentratorService = Self {
125124 concentrator,
You can’t perform that action at this time.
0 commit comments