From 1140c5c6b47305f1baa79d56f4e8a69edb63f263 Mon Sep 17 00:00:00 2001 From: Jesse Szwedko Date: Fri, 5 May 2023 12:17:13 -0700 Subject: [PATCH] enhancement(observability): Log underlying error for unhandled HTTP errors 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) }