Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove sensitive data from analytics #1563

Merged
merged 5 commits into from
Mar 13, 2023
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions crates/rerun/src/crash_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,21 @@ fn install_panic_hook(_build_info: BuildInfo) {
let mut event = re_analytics::Event::append("crash-panic")
.with_build_info(&_build_info)
.with_prop("callstack", callstack);

// `panic_info.message` is unstable, so this is the recommended way of getting
// the panic message out. We need both the `&str` and `String` variants.
if let Some(msg) = panic_info.payload().downcast_ref::<&str>() {
event = event.with_prop("message", *msg);
} else if let Some(msg) = panic_info.payload().downcast_ref::<String>() {
event = event.with_prop("message", msg.clone());
}

if let Some(location) = panic_info.location() {
event = event.with_prop(
"location",
format!("{}:{}", location.file(), location.line()),
);
let file =
anonymize_source_file_path(&std::path::PathBuf::from(location.file()));
event = event.with_prop("location", format!("{file}:{}", location.line()));
}

analytics.record(event);

std::thread::sleep(std::time::Duration::from_secs(1)); // Give analytics time to send the event
Expand Down