mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Bump all @sentry related packages (#5155)
This commit is contained in:
1 parent
8e8ad6663b
commit
7fffa3643c
5 files changed
+105
-149
No files matched your search
@@ -4,10 +4,11 @@
|
||||
*/
|
||||
|
||||
import { Dedupe, Offline } from "@sentry/integrations";
|
||||
import * as Sentry from "@sentry/electron";
|
||||
import { sentryDsn, isProduction } from "./vars";
|
||||
import { UserStore } from "./user-store";
|
||||
import { inspect } from "util";
|
||||
import type { BrowserOptions } from "@sentry/electron/renderer";
|
||||
import type { ElectronMainOptions } from "@sentry/electron/main";
|
||||
|
||||
/**
|
||||
* "Translate" 'browser' to 'main' as Lens developer more familiar with the term 'main'
|
||||
@@ -23,10 +24,14 @@ function mapProcessName(processType: string) {
|
||||
/**
|
||||
* Initialize Sentry for the current process so to send errors for debugging.
|
||||
*/
|
||||
export function SentryInit() {
|
||||
export function initializeSentryReporting(init: (opts: BrowserOptions | ElectronMainOptions) => void) {
|
||||
const processName = mapProcessName(process.type);
|
||||
|
||||
Sentry.init({
|
||||
if (!sentryDsn) {
|
||||
return; // do nothing if not configured to avoid uncaught error in dev mode
|
||||
}
|
||||
|
||||
init({
|
||||
beforeSend: (event) => {
|
||||
// default to false, in case instance of UserStore is not created (yet)
|
||||
const allowErrorReporting = UserStore.getInstance(false)?.allowErrorReporting ?? false;
|
||||
|
||||
+13
-10
@@ -35,7 +35,7 @@ import configurePackages from "../common/configure-packages";
|
||||
import { PrometheusProviderRegistry } from "./prometheus";
|
||||
import * as initializers from "./initializers";
|
||||
import { WeblinkStore } from "../common/weblink-store";
|
||||
import { SentryInit } from "../common/sentry";
|
||||
import { initializeSentryReporting } from "../common/sentry";
|
||||
import { ensureDir } from "fs-extra";
|
||||
import { initMenu } from "./menu/menu";
|
||||
import { kubeApiUpgradeRequest } from "./proxy-functions";
|
||||
@@ -60,21 +60,24 @@ import navigateToPreferencesInjectable from "../common/front-end-routing/routes/
|
||||
import syncGeneralCatalogEntitiesInjectable from "./catalog-sources/sync-general-catalog-entities.injectable";
|
||||
import hotbarStoreInjectable from "../common/hotbar-store.injectable";
|
||||
import applicationMenuItemsInjectable from "./menu/application-menu-items.injectable";
|
||||
import type { DiContainer } from "@ogre-tools/injectable";
|
||||
import { init } from "@sentry/electron/main";
|
||||
|
||||
const di = getDi();
|
||||
async function main(di: DiContainer) {
|
||||
app.setName(appName);
|
||||
|
||||
app.setName(appName);
|
||||
|
||||
app.on("ready", async () => {
|
||||
/**
|
||||
* Note: this MUST be called before electron's "ready" event has been emitted.
|
||||
*/
|
||||
initializeSentryReporting(init);
|
||||
await di.runSetups();
|
||||
await app.whenReady();
|
||||
|
||||
injectSystemCAs();
|
||||
|
||||
const onCloseCleanup = disposer();
|
||||
const onQuitCleanup = disposer();
|
||||
|
||||
SentryInit();
|
||||
|
||||
logger.info(`📟 Setting ${productName} as protocol client for lens://`);
|
||||
|
||||
if (app.setAsDefaultProtocolClient("lens")) {
|
||||
@@ -187,8 +190,6 @@ app.on("ready", async () => {
|
||||
lensProtocolRouterMain.route(rawUrl);
|
||||
});
|
||||
|
||||
logger.debug("[APP-MAIN] waiting for 'ready' and other messages");
|
||||
|
||||
const directoryForExes = di.inject(directoryForExesInjectable);
|
||||
|
||||
logger.info(`🚀 Starting ${productName} from "${directoryForExes}"`);
|
||||
@@ -357,7 +358,9 @@ app.on("ready", async () => {
|
||||
setTimeout(() => {
|
||||
appEventBus.emit({ name: "service", action: "start" });
|
||||
}, 1000);
|
||||
});
|
||||
}
|
||||
|
||||
main(getDi());
|
||||
|
||||
/**
|
||||
* Exports for virtual package "@k8slens/extensions" for main-process.
|
||||
|
||||
@@ -21,7 +21,7 @@ import configurePackages from "../common/configure-packages";
|
||||
import * as initializers from "./initializers";
|
||||
import logger from "../common/logger";
|
||||
import { WeblinkStore } from "../common/weblink-store";
|
||||
import { SentryInit } from "../common/sentry";
|
||||
import { initializeSentryReporting } from "../common/sentry";
|
||||
import { registerCustomThemes } from "./components/monaco-editor";
|
||||
import { getDi } from "./getDi";
|
||||
import { DiContextProvider } from "@ogre-tools/injectable-react";
|
||||
@@ -41,12 +41,8 @@ import navigateToAddClusterInjectable from "../common/front-end-routing/routes/
|
||||
import addSyncEntriesInjectable from "./initializers/add-sync-entries.injectable";
|
||||
import hotbarStoreInjectable from "../common/hotbar-store.injectable";
|
||||
import { bindEvents } from "./navigation/events";
|
||||
import deleteClusterDialogModelInjectable
|
||||
from "./components/delete-cluster-dialog/delete-cluster-dialog-model/delete-cluster-dialog-model.injectable";
|
||||
|
||||
if (process.isMainFrame) {
|
||||
SentryInit();
|
||||
}
|
||||
import deleteClusterDialogModelInjectable from "./components/delete-cluster-dialog/delete-cluster-dialog-model/delete-cluster-dialog-model.injectable";
|
||||
import { init } from "@sentry/electron/renderer";
|
||||
|
||||
configurePackages(); // global packages
|
||||
registerCustomThemes(); // monaco editor themes
|
||||
@@ -63,6 +59,10 @@ async function attachChromeDebugger() {
|
||||
}
|
||||
|
||||
export async function bootstrap(di: DiContainer) {
|
||||
if (process.isMainFrame) {
|
||||
initializeSentryReporting(init);
|
||||
}
|
||||
|
||||
await di.runSetups();
|
||||
|
||||
// TODO: Consolidate import time side-effect to setup time
|
||||
|
||||
Reference in new issue
Block a user