Skip to content

Commit 5973888

Browse files
committed
chore: make tag logic actually compile
1 parent 4d56e2a commit 5973888

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/wasm/src/sentry_gauge.rs

+9-4
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,12 @@ pub trait SentryGauge {
217217
fn update(&mut self) -> Result<()>;
218218
}
219219

220+
fn set_sentry_tags(scope: &mut sentry::Scope) {
221+
let config = Config::get_config();
222+
scope.set_tag("developer", if let Some(config) = &config { config.addon.developer.clone() } else { "unknown".into() });
223+
scope.set_tag("product", if let Some(config) = &config { config.addon.product.clone() } else { "unknown".into() });
224+
}
225+
220226
/// Create a sentry "executor" around a gauge
221227
///
222228
/// Note: This MUST be the first function called within a gauge callback. Nothing will run after this
@@ -255,10 +261,7 @@ where
255261
..Default::default()
256262
}));
257263

258-
let config = Config::get_config();
259-
260-
scope.set_tag("developer", if let Some(config) = config { config.addon.developer } else { "unknown".into() });
261-
scope.set_tag("product", if let Some(config) = config { config.addon.product} else { "unknown".into() });
264+
set_sentry_tags(scope);
262265
});
263266

264267
// Drain any pending reports. We need to structure it like this as opposed to just a top level `let Ok(state) = ...`` due to the fact we should not be holding a MutexGuard across an await point
@@ -329,6 +332,8 @@ where
329332
Ok(())
330333
}
331334

335+
336+
332337
/// A convenience macro to handle the gauge entrypoint and sentry wrapping around a struct that implements `SentryGauge`
333338
///
334339
/// Example: `sentry_gauge!(MyGauge, my_gauge_name)`

0 commit comments

Comments
 (0)