Skip to content

Commit f9082fa

Browse files
fix: error message in otel ingestion (#1521)
update incorrect log source error add telemetry type to the error message
1 parent b25cdfa commit f9082fa

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/handlers/http/ingest.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,10 @@ pub async fn setup_otel_stream(
182182

183183
let log_source = LogSource::from(log_source.to_str().unwrap());
184184
if log_source != expected_log_source {
185-
return Err(PostError::IncorrectLogSource(expected_log_source));
185+
return Err(PostError::IncorrectLogSource(
186+
expected_log_source,
187+
telemetry_type.to_string(),
188+
));
186189
}
187190

188191
let stream_name = stream_name.to_str().unwrap().to_owned();
@@ -484,8 +487,8 @@ pub enum PostError {
484487
OtelNotSupported,
485488
#[error("The stream {0} is reserved for internal use and cannot be ingested into")]
486489
InternalStream(String),
487-
#[error(r#"Please use "x-p-log-source: {0}" for ingesting otel logs"#)]
488-
IncorrectLogSource(LogSource),
490+
#[error(r#"Please use "x-p-log-source: {0}" for ingesting otel {1} data"#)]
491+
IncorrectLogSource(LogSource, String),
489492
#[error("Ingestion is not allowed in Query mode")]
490493
IngestionNotAllowed,
491494
#[error("Missing field for time partition in json: {0}")]
@@ -516,7 +519,7 @@ impl actix_web::ResponseError for PostError {
516519
| Header(_)
517520
| Invalid(_)
518521
| InternalStream(_)
519-
| IncorrectLogSource(_)
522+
| IncorrectLogSource(_, _)
520523
| IngestionNotAllowed
521524
| MissingTimePartition(_)
522525
| KnownFormat(_)

0 commit comments

Comments
 (0)