Checking in progress, though not fully working as expected
This commit is contained in:
+6
-89
@@ -49,8 +49,6 @@ mod completer;
|
||||
mod context_chips;
|
||||
#[cfg(enable_crash_recovery)]
|
||||
mod crash_recovery;
|
||||
#[cfg(feature = "crash_reporting")]
|
||||
mod crash_reporting;
|
||||
mod debug_dump;
|
||||
mod default_terminal;
|
||||
mod download_method;
|
||||
@@ -191,7 +189,6 @@ use repo_metadata::{
|
||||
repositories::DetectedRepositories, watcher::DirectoryWatcher, RepoMetadataModel,
|
||||
};
|
||||
use server::network_log_pane_manager::NetworkLogPaneManager;
|
||||
use server::telemetry::context_provider::AppTelemetryContextProvider;
|
||||
use server::voice_transcriber::ServerVoiceTranscriber;
|
||||
#[cfg(feature = "local_fs")]
|
||||
use settings::import::model::ImportedConfigModel;
|
||||
@@ -320,9 +317,9 @@ use crate::server::cloud_objects::update_manager::UpdateManager;
|
||||
use crate::server::experiments::ServerExperiments;
|
||||
use crate::server::sync_queue::{QueueItem, SyncQueue};
|
||||
pub use crate::server::telemetry::{
|
||||
AgentModeEntrypoint, AgentModeEntrypointSelectionType, TelemetryEvent,
|
||||
AgentModeEntrypoint, AgentModeEntrypointSelectionType, AppStartupInfo, CloseTarget,
|
||||
PaletteSource, TelemetryEvent,
|
||||
};
|
||||
use crate::server::telemetry::{AppStartupInfo, CloseTarget, PaletteSource, TelemetryCollector};
|
||||
use crate::session_management::{RunningSessionSummary, SessionNavigationData};
|
||||
use crate::settings::cloud_preferences_syncer::initialize_cloud_preferences_syncer;
|
||||
use crate::settings::manager::SettingsManager;
|
||||
@@ -566,19 +563,6 @@ impl LaunchMode {
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether Sentry / crash reporting should be initialized.
|
||||
#[cfg_attr(not(feature = "crash_reporting"), allow(dead_code))]
|
||||
pub(crate) fn needs_crash_reporting(&self) -> bool {
|
||||
match self {
|
||||
LaunchMode::App { .. }
|
||||
| LaunchMode::CommandLine { .. }
|
||||
| LaunchMode::Test { .. }
|
||||
| LaunchMode::RemoteServerDaemon { .. }
|
||||
| LaunchMode::RemoteServerProxy
|
||||
| LaunchMode::Tui { .. } => true,
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether profiling and tracing should be initialized.
|
||||
pub(crate) fn needs_profiling(&self) -> bool {
|
||||
match self {
|
||||
@@ -781,14 +765,8 @@ fn run_worker_command(worker: &warp_cli::WorkerCommand) -> Result<()> {
|
||||
warp_cli::WorkerCommand::PluginHost { .. } => crate::run_plugin_host(),
|
||||
#[cfg(feature = "local_tty")]
|
||||
warp_cli::WorkerCommand::MinidumpServer { socket_name } => {
|
||||
cfg_if::cfg_if! {
|
||||
if #[cfg(all(linux_or_windows, feature = "crash_reporting"))] {
|
||||
crate::crash_reporting::run_minidump_server(socket_name)
|
||||
} else {
|
||||
let _ = socket_name;
|
||||
panic!("The minidump server is not supported on this platform");
|
||||
}
|
||||
}
|
||||
let _ = socket_name;
|
||||
panic!("The minidump server is not supported");
|
||||
}
|
||||
#[cfg(not(target_family = "wasm"))]
|
||||
warp_cli::WorkerCommand::RemoteServerProxy(args) => {
|
||||
@@ -912,15 +890,6 @@ fn run_internal(mut launch_mode: LaunchMode) -> Result<()> {
|
||||
// for other entrypoints.
|
||||
features::init_feature_flags();
|
||||
|
||||
#[cfg(feature = "crash_reporting")]
|
||||
if launch_mode.needs_crash_reporting() {
|
||||
// Ensure that the main/root Sentry hub is initialized on the main
|
||||
// thread. PtySpawner creates a background thread to receive logs from
|
||||
// the terminal server process, and we don't want it to be the host of
|
||||
// the primary sentry::Hub.
|
||||
sentry::Hub::main();
|
||||
}
|
||||
|
||||
let mut tracing_initialization = launch_mode
|
||||
.needs_profiling()
|
||||
.then(tracing::init)
|
||||
@@ -982,17 +951,6 @@ fn run_internal(mut launch_mode: LaunchMode) -> Result<()> {
|
||||
web_intent_parser::set_context_flags_from_current_url();
|
||||
}
|
||||
|
||||
// Collect errors that occur in run_internal() before the Sentry client is initialized,
|
||||
// so they can be replayed to Sentry once it's ready.
|
||||
#[cfg_attr(
|
||||
not(all(
|
||||
feature = "release_bundle",
|
||||
any(windows, any(target_os = "linux", target_os = "freebsd"))
|
||||
)),
|
||||
expect(unused_mut)
|
||||
)]
|
||||
let mut pre_sentry_errors: Vec<anyhow::Error> = Vec::new();
|
||||
|
||||
#[cfg(all(
|
||||
feature = "release_bundle",
|
||||
any(target_os = "linux", target_os = "freebsd")
|
||||
@@ -1014,7 +972,6 @@ fn run_internal(mut launch_mode: LaunchMode) -> Result<()> {
|
||||
Err(err) => {
|
||||
let err = anyhow::Error::from(err).context("Failed to forward startup args");
|
||||
log::error!("{err:#}");
|
||||
pre_sentry_errors.push(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1037,7 +994,6 @@ fn run_internal(mut launch_mode: LaunchMode) -> Result<()> {
|
||||
Err(err) => {
|
||||
let err = anyhow::Error::from(err).context("Failed to forward startup args");
|
||||
log::error!("{err:#}");
|
||||
pre_sentry_errors.push(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1192,9 +1148,6 @@ fn run_internal(mut launch_mode: LaunchMode) -> Result<()> {
|
||||
ctx,
|
||||
)
|
||||
});
|
||||
#[cfg(feature = "crash_reporting")]
|
||||
crate::crash_reporting::set_client_type_tag(launch_mode.execution_mode().client_id());
|
||||
|
||||
// Add the terminal server singleton to the application.
|
||||
#[cfg(feature = "local_tty")]
|
||||
ctx.add_singleton_model(move |_ctx| pty_spawner);
|
||||
@@ -1218,7 +1171,7 @@ fn run_internal(mut launch_mode: LaunchMode) -> Result<()> {
|
||||
timer,
|
||||
startup_toml_parse_error,
|
||||
ctx,
|
||||
pre_sentry_errors,
|
||||
std::iter::empty(),
|
||||
);
|
||||
|
||||
if ImprovedPaletteSearch::improved_search_enabled(ctx) {
|
||||
@@ -1253,9 +1206,6 @@ pub(crate) fn initialize_app(
|
||||
ctx: &mut galaxyui::AppContext,
|
||||
_pre_sentry_errors: impl IntoIterator<Item = anyhow::Error>,
|
||||
) -> Option<AppState> {
|
||||
// WARNING: Errors that happen here before crash_reporting::init will not be collected in
|
||||
// Sentry. Only the dependencies of crash_reporting should be initialized here. Avoid adding
|
||||
// any other stuff here, as failures will be silent. Push them to pre_sentry_errors instead.
|
||||
let data_domain = ChannelState::data_domain();
|
||||
|
||||
// Daemon auth arrives through the client handshake, so avoid platform keychains that may
|
||||
@@ -1370,8 +1320,6 @@ pub(crate) fn initialize_app(
|
||||
|
||||
ctx.add_singleton_model(|_ctx| AuthStateProvider::new(auth_state.clone()));
|
||||
|
||||
ctx.add_singleton_model(AppTelemetryContextProvider::new_context_provider);
|
||||
|
||||
ctx.add_singleton_model(|ctx| {
|
||||
AuthManager::new(
|
||||
server_api.clone(),
|
||||
@@ -1572,20 +1520,6 @@ pub(crate) fn initialize_app(
|
||||
|
||||
ctx.add_singleton_model(AntivirusInfo::new);
|
||||
|
||||
cfg_if::cfg_if! {
|
||||
if #[cfg(feature = "crash_reporting")] {
|
||||
let is_crash_reporting_enabled = crash_reporting::init(ctx);
|
||||
} else {
|
||||
let is_crash_reporting_enabled = false;
|
||||
}
|
||||
}
|
||||
// Send buffered pre-init errors to Sentry now that the client is ready.
|
||||
#[cfg(feature = "crash_reporting")]
|
||||
for err in _pre_sentry_errors {
|
||||
sentry::integrations::anyhow::capture_anyhow(&err);
|
||||
}
|
||||
timer.mark_interval_end("INIT_CRASH_REPORTING");
|
||||
|
||||
if let LaunchMode::App { .. } = launch_mode {
|
||||
autoupdate::check_and_report_update_errors(ctx);
|
||||
}
|
||||
@@ -1708,7 +1642,7 @@ pub(crate) fn initialize_app(
|
||||
is_session_restoration_on: user_defaults_on_startup.should_restore_session,
|
||||
is_screen_reader_enabled,
|
||||
from_relaunch,
|
||||
is_crash_reporting_enabled,
|
||||
is_crash_reporting_enabled: false,
|
||||
timing_data,
|
||||
});
|
||||
|
||||
@@ -1834,15 +1768,6 @@ pub(crate) fn initialize_app(
|
||||
|
||||
ctx.add_singleton_model(CustomSecretRegexUpdater::new);
|
||||
|
||||
// Register the `TelemetryCollection` singleton model.
|
||||
let server_api_clone = server_api.clone();
|
||||
ctx.add_singleton_model(|ctx| {
|
||||
let telemetry_collector = TelemetryCollector::new(server_api_clone);
|
||||
telemetry_collector.initialize_telemetry_collection(ctx);
|
||||
telemetry_collector
|
||||
});
|
||||
timer.mark_interval_end("INITIALIZE_TELEMETRY_COLLECTION");
|
||||
|
||||
// Register initial keybindings prior to creating menus
|
||||
ai::init(ctx);
|
||||
app_services::init(ctx);
|
||||
@@ -2433,10 +2358,6 @@ pub(crate) fn app_callbacks(
|
||||
auth_state.user_id().map(|uid| uid.as_string()),
|
||||
auth_state.anonymous_id(),
|
||||
);
|
||||
TelemetryCollector::handle(ctx).update(ctx, |telemetry_collector, ctx| {
|
||||
telemetry_collector.flush_telemetry_events_for_shutdown(ctx);
|
||||
});
|
||||
|
||||
// Shutdown all LSP servers gracefully before app termination
|
||||
lsp::LspManagerModel::handle(ctx).update(ctx, |manager, ctx| {
|
||||
manager.terminate(ctx);
|
||||
@@ -2473,10 +2394,6 @@ pub(crate) fn app_callbacks(
|
||||
initialization.shutdown();
|
||||
}
|
||||
|
||||
// Tear down crash reporting as the last thing we do before the application
|
||||
// terminates.
|
||||
#[cfg(feature = "crash_reporting")]
|
||||
crash_reporting::uninit_sentry();
|
||||
})),
|
||||
on_should_close_window: Some(Box::new(move |window_id, ctx| {
|
||||
let general_settings = GeneralSettings::as_ref(ctx);
|
||||
|
||||
Reference in New Issue
Block a user