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 {
373
373
long,
374
374
env = "P_OTEL_ATTRIBUTES_ALLOWED_LIMIT" ,
375
375
default_value = "200" ,
376
+ value_parser = validation:: validate_otel_attributes_allowed_limit,
376
377
help = "allowed limit for otel attributes"
377
378
) ]
378
379
pub otel_attributes_allowed_limit : usize ,
Original file line number Diff line number Diff line change @@ -173,4 +173,19 @@ pub mod validation {
173
173
Err ( "Invalid value for max disk usage. It should be given as 90.0 for 90%" . to_string ( ) )
174
174
}
175
175
}
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
+ }
176
191
}
You can’t perform that action at this time.
0 commit comments