File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,9 @@ pub mod validation {
95
95
96
96
use super :: { Compression , Mode } ;
97
97
98
+ // Maximum allowed otel attributes per event
99
+ const OTEL_ATTRIBUTES_ALLOWED_LIMIT : usize = 200 ;
100
+
98
101
pub fn file_path ( s : & str ) -> Result < PathBuf , String > {
99
102
if s. is_empty ( ) {
100
103
return Err ( "empty path" . to_owned ( ) ) ;
@@ -176,16 +179,16 @@ pub mod validation {
176
179
177
180
pub fn validate_otel_attributes_allowed_limit ( s : & str ) -> Result < usize , String > {
178
181
if let Ok ( size) = s. parse :: < usize > ( ) {
179
- if ( 1 ..=200 ) . contains ( & size) {
182
+ if ( 1 ..=OTEL_ATTRIBUTES_ALLOWED_LIMIT ) . contains ( & size) {
180
183
Ok ( size)
181
184
} else {
182
185
Err ( format ! (
183
- "Invalid value for size . It should be between 1 and {}" ,
184
- 200
186
+ "Invalid value for P_OTEL_ATTRIBUTES_ALLOWED_LIMIT . It should be between 1 and {}" ,
187
+ OTEL_ATTRIBUTES_ALLOWED_LIMIT
185
188
) )
186
189
}
187
190
} else {
188
- Err ( "Invalid value for size . It should be given as integer value" . to_string ( ) )
191
+ Err ( "Invalid value for P_OTEL_ATTRIBUTES_ALLOWED_LIMIT . It should be given as integer value" . to_string ( ) )
189
192
}
190
193
}
191
194
}
You can’t perform that action at this time.
0 commit comments