From 7ba8dee04a819ada1039408ef2f45c40adb0985b Mon Sep 17 00:00:00 2001 From: Ivan L Date: Tue, 5 Dec 2023 16:33:57 +0400 Subject: [PATCH] restore the backward compatibility --- sentry-tracing/src/converters.rs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/sentry-tracing/src/converters.rs b/sentry-tracing/src/converters.rs index 41a67524..b2945e63 100644 --- a/sentry-tracing/src/converters.rs +++ b/sentry-tracing/src/converters.rs @@ -147,7 +147,10 @@ impl Visit for FieldVisitor { } /// Creates a [`Breadcrumb`] from a given [`tracing_core::Event`] -pub fn breadcrumb_from_event(event: &tracing_core::Event, _ctx: Option>) -> Breadcrumb +pub fn breadcrumb_from_event<'context, S>( + event: &tracing_core::Event, + _ctx: impl Into>>, +) -> Breadcrumb where S: Subscriber + for<'a> LookupSpan<'a>, { @@ -220,11 +223,14 @@ fn contexts_from_event( } /// Creates an [`Event`] from a given [`tracing_core::Event`] -pub fn event_from_event(event: &tracing_core::Event, ctx: Option>) -> Event<'static> +pub fn event_from_event<'context, S>( + event: &tracing_core::Event, + ctx: impl Into>>, +) -> Event<'static> where S: Subscriber + for<'a> LookupSpan<'a>, { - let (message, mut visitor) = extract_event_data(event, ctx); + let (message, mut visitor) = extract_event_data(event, ctx.into()); Event { logger: Some(event.metadata().target().to_owned()), @@ -237,9 +243,9 @@ where } /// Creates an exception [`Event`] from a given [`tracing_core::Event`] -pub fn exception_from_event( +pub fn exception_from_event<'context, S>( event: &tracing_core::Event, - ctx: Option>, + ctx: impl Into>>, ) -> Event<'static> where S: Subscriber + for<'a> LookupSpan<'a>, @@ -248,7 +254,7 @@ where // proper grouping and issue metadata generation. tracing_core::Record does not contain sufficient // information for this. However, it may contain a serialized error which we can parse to emit // an exception record. - let (mut message, visitor) = extract_event_data(event, ctx); + let (mut message, visitor) = extract_event_data(event, ctx.into()); let FieldVisitor { mut exceptions, mut json_values,