From bf8376c3030e6d6df61ca245f2d8be87443bf075 Mon Sep 17 00:00:00 2001 From: Jesse Szwedko Date: Mon, 8 May 2023 09:58:26 -0500 Subject: [PATCH] enhancement(observability): Log underlying error for unhandled HTTP errors (#17327) To help with debugging Signed-off-by: Jesse Szwedko --- src/internal_events/http.rs | 6 +++--- src/sources/util/http/prelude.rs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/internal_events/http.rs b/src/internal_events/http.rs index 9a1cd2ea20137..a1879c2379bcb 100644 --- a/src/internal_events/http.rs +++ b/src/internal_events/http.rs @@ -130,11 +130,11 @@ impl<'a> InternalEvent for HttpDecompressError<'a> { } } -pub struct HttpInternalError { - pub message: &'static str, +pub struct HttpInternalError<'a> { + pub message: &'a str, } -impl InternalEvent for HttpInternalError { +impl<'a> InternalEvent for HttpInternalError<'a> { fn emit(self) { error!( message = %self.message, diff --git a/src/sources/util/http/prelude.rs b/src/sources/util/http/prelude.rs index 3b07c38a1da9b..26f073f7bb7d1 100644 --- a/src/sources/util/http/prelude.rs +++ b/src/sources/util/http/prelude.rs @@ -165,7 +165,7 @@ pub trait HttpSource: Clone + Send + Sync + 'static { } else { //other internal error - will return 500 internal server error emit!(HttpInternalError { - message: "Internal error." + message: &format!("Internal error: {:?}", r) }); Err(r) }