Skip to content

Commit 59582a6

Browse files
add const for OTEL_ATTRIBUTES_ALLOWED_LIMIT
1 parent a11790c commit 59582a6

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/option.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ pub mod validation {
9595

9696
use super::{Compression, Mode};
9797

98+
// Maximum allowed otel attributes per event
99+
const OTEL_ATTRIBUTES_ALLOWED_LIMIT: usize = 200;
100+
98101
pub fn file_path(s: &str) -> Result<PathBuf, String> {
99102
if s.is_empty() {
100103
return Err("empty path".to_owned());
@@ -176,16 +179,16 @@ pub mod validation {
176179

177180
pub fn validate_otel_attributes_allowed_limit(s: &str) -> Result<usize, String> {
178181
if let Ok(size) = s.parse::<usize>() {
179-
if (1..=200).contains(&size) {
182+
if (1..=OTEL_ATTRIBUTES_ALLOWED_LIMIT).contains(&size) {
180183
Ok(size)
181184
} else {
182185
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
185188
))
186189
}
187190
} 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())
189192
}
190193
}
191194
}

0 commit comments

Comments
 (0)