Skip to content

Commit 28f47d3

Browse files
authored
refactor(debug-images): force init DEBUG_META on integration init (#773)
* refactor(debug-images): force init `DebugMeta` immediately * import
1 parent 4db8c35 commit 28f47d3

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

sentry-debug-images/src/integration.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ use std::sync::LazyLock;
44
use sentry_core::protocol::{DebugMeta, Event};
55
use sentry_core::{ClientOptions, Integration};
66

7+
static DEBUG_META: LazyLock<DebugMeta> = LazyLock::new(|| DebugMeta {
8+
images: crate::debug_images(),
9+
..Default::default()
10+
});
11+
712
/// The Sentry Debug Images Integration.
813
pub struct DebugImagesIntegration {
914
filter: Box<dyn Fn(&Event<'_>) -> bool + Send + Sync>,
@@ -30,6 +35,7 @@ impl DebugImagesIntegration {
3035

3136
impl Default for DebugImagesIntegration {
3237
fn default() -> Self {
38+
LazyLock::force(&DEBUG_META);
3339
Self {
3440
filter: Box::new(|_| true),
3541
}
@@ -56,11 +62,6 @@ impl Integration for DebugImagesIntegration {
5662
mut event: Event<'static>,
5763
_opts: &ClientOptions,
5864
) -> Option<Event<'static>> {
59-
static DEBUG_META: LazyLock<DebugMeta> = LazyLock::new(|| DebugMeta {
60-
images: crate::debug_images(),
61-
..Default::default()
62-
});
63-
6465
if event.debug_meta.is_empty() && (self.filter)(&event) {
6566
event.debug_meta = Cow::Borrowed(&DEBUG_META);
6667
}

0 commit comments

Comments
 (0)