File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -373,6 +373,7 @@ pub struct Options {
373373 long,
374374 env = "P_OTEL_ATTRIBUTES_ALLOWED_LIMIT" ,
375375 default_value = "200" ,
376+ value_parser = validation:: validate_otel_attributes_allowed_limit,
376377 help = "allowed limit for otel attributes"
377378 ) ]
378379 pub otel_attributes_allowed_limit : usize ,
Original file line number Diff line number Diff line change @@ -173,4 +173,19 @@ pub mod validation {
173173 Err ( "Invalid value for max disk usage. It should be given as 90.0 for 90%" . to_string ( ) )
174174 }
175175 }
176+
177+ pub fn validate_otel_attributes_allowed_limit ( s : & str ) -> Result < usize , String > {
178+ if let Ok ( size) = s. parse :: < usize > ( ) {
179+ if ( 1 ..=200 ) . contains ( & size) {
180+ Ok ( size)
181+ } else {
182+ Err ( format ! (
183+ "Invalid value for size. It should be between 1 and {}" ,
184+ 200
185+ ) )
186+ }
187+ } else {
188+ Err ( "Invalid value for size. It should be given as integer value" . to_string ( ) )
189+ }
190+ }
176191}
You can’t perform that action at this time.
0 commit comments