Skip to content

Commit

Permalink
chore: disable sentry whilst we work out server issues
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelHillcox committed Jun 8, 2024
1 parent cc6ecc0 commit 58bf172
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 77 deletions.
55 changes: 27 additions & 28 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import FTBInput from '@/components/atoms/input/FTBInput.vue';
import Popover from '@/components/atoms/Popover.vue';
import Modal from '@/components/atoms/modal/Modal.vue';
import Message from '@/components/atoms/Message.vue';
import {BrowserTracing} from '@sentry/tracing';
import * as Sentry from '@sentry/vue';
// import {BrowserTracing} from '@sentry/tracing';
// import * as Sentry from '@sentry/vue';
import ModalFooter from '@/components/atoms/modal/ModalFooter.vue';
import ModalBody from '@/components/atoms/modal/ModalBody.vue';
import {localiseNumber, toTitleCase} from '@/utils/helpers/stringHelpers';
Expand All @@ -36,7 +36,6 @@ import VueNativeSock from 'vue-native-websocket';
// @ts-ignore - no types
import VueVirtualScroller from 'vue-virtual-scroller';
import {createLogger} from '@/core/logger';
import {constants} from '@/core/constants';

// Use the relative time module from dayjs
dayjs.extend(relativeTime);
Expand All @@ -53,31 +52,31 @@ const appSetup = async () => {
console.error(e);
}

if (process.env.NODE_ENV === 'production') {
logger.info("Setting up sentry");
Sentry.init({
Vue,
environment: constants.platform,
dsn: process.env.VUE_APP_SENTRY_DSN,
integrations: [
new BrowserTracing({
routingInstrumentation: Sentry.vueRouterInstrumentation(router),
}),
],
release: `${platform.get.config.version}`,
dist: `${process.env.VUE_APP_TARGET_PLATFORM}`,
initialScope: {
tags: {
'release.public': platform.get.config.version,
'release.platform': await platform.get.utils.getPlatformVersion(),
'os.arch': platform.get.utils.getOsArch(),
},
},

trackComponents: true,
tracesSampleRate: 1.0,
});
}
// if (process.env.NODE_ENV === 'production') {
// logger.info("Setting up sentry");
// Sentry.init({
// Vue,
// environment: constants.platform,
// dsn: process.env.VUE_APP_SENTRY_DSN,
// integrations: [
// new BrowserTracing({
// routingInstrumentation: Sentry.vueRouterInstrumentation(router),
// }),
// ],
// release: `${platform.get.config.version}`,
// dist: `${process.env.VUE_APP_TARGET_PLATFORM}`,
// initialScope: {
// tags: {
// 'release.public': platform.get.config.version,
// 'release.platform': await platform.get.utils.getPlatformVersion(),
// 'os.arch': platform.get.utils.getOsArch(),
// },
// },
//
// trackComponents: true,
// tracesSampleRate: 1.0,
// });
// }

library.add(fas);
library.add(fab);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
import com.google.common.collect.ImmutableMap;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.google.gson.JsonObject;
import io.sentry.Sentry;
import io.sentry.log4j2.BuildConfig;
import io.sentry.protocol.SdkVersion;
import net.covers1624.jdkutils.JavaInstall;
import net.covers1624.jdkutils.locator.JavaLocator;
import net.covers1624.quack.logging.log4j2.Log4jUtils;
Expand Down Expand Up @@ -46,33 +43,33 @@ public class CreeperLauncher {

// Yes, second static block, this will run before Log4j is initialized.
// Must be here so Sentry doesn't re-configure itself twice and bork the appender.
static {

// noinspection ConstantConditions,MismatchedStringCase
if (Constants.SENTRY_DSN.startsWith("https")) {
Sentry.init(opts -> {
opts.setDsn(Constants.SENTRY_DSN);

// Yoinked from SentryAppender. There exists no way to configure attachServerName from system properties. We must init sentry manually.
// Ideally I'd just want to set the sentry properties file and let log4j auto initialize it.
opts.setSentryClientName(BuildConfig.SENTRY_LOG4J2_SDK_NAME);
SdkVersion sdkVersion = SdkVersion.updateSdkVersion(opts.getSdkVersion(), BuildConfig.SENTRY_LOG4J2_SDK_NAME, BuildConfig.VERSION_NAME);
sdkVersion.addPackage("maven:io.sentry:sentry-log4j2", BuildConfig.VERSION_NAME);
//noinspection UnstableApiUsage
opts.setSdkVersion(sdkVersion);
// End Yoinked from SentryAppender.

opts.setAttachServerName(false);
opts.setEnableUncaughtExceptionHandler(true);
opts.setRelease(Constants.APPVERSION);
opts.setTag("branch", Constants.BRANCH);
opts.setTag("platform", Constants.PLATFORM);
opts.setTag("os.name", System.getProperty("os.name"));
opts.setTag("os.version", System.getProperty("os.version"));
opts.setTag("os.arch", Architecture.current().name());
});
}
}
// static {
//
// // noinspection ConstantConditions,MismatchedStringCase
// if (Constants.SENTRY_DSN.startsWith("https")) {
// Sentry.init(opts -> {
// opts.setDsn(Constants.SENTRY_DSN);
//
// // Yoinked from SentryAppender. There exists no way to configure attachServerName from system properties. We must init sentry manually.
// // Ideally I'd just want to set the sentry properties file and let log4j auto initialize it.
// opts.setSentryClientName(BuildConfig.SENTRY_LOG4J2_SDK_NAME);
// SdkVersion sdkVersion = SdkVersion.updateSdkVersion(opts.getSdkVersion(), BuildConfig.SENTRY_LOG4J2_SDK_NAME, BuildConfig.VERSION_NAME);
// sdkVersion.addPackage("maven:io.sentry:sentry-log4j2", BuildConfig.VERSION_NAME);
// //noinspection UnstableApiUsage
// opts.setSdkVersion(sdkVersion);
// // End Yoinked from SentryAppender.
//
// opts.setAttachServerName(false);
// opts.setEnableUncaughtExceptionHandler(true);
// opts.setRelease(Constants.APPVERSION);
// opts.setTag("branch", Constants.BRANCH);
// opts.setTag("platform", Constants.PLATFORM);
// opts.setTag("os.name", System.getProperty("os.name"));
// opts.setTag("os.version", System.getProperty("os.version"));
// opts.setTag("os.arch", Architecture.current().name());
// });
// }
// }

private static final Logger LOGGER = LogManager.getLogger();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package net.creeperhost.creeperlauncher.api.handlers.instances;

import io.sentry.Sentry;
//import io.sentry.Sentry;
import net.creeperhost.creeperlauncher.CreeperLauncher;
import net.creeperhost.creeperlauncher.Instances;
import net.creeperhost.creeperlauncher.api.WebSocketHandler;
Expand Down Expand Up @@ -61,7 +61,7 @@ public void handle(LaunchInstanceData data) {
} else {
LOGGER.error(NO_SENTRY, "Failed to launch instance.", ex);
Throwable cause = ex.getCause();
Sentry.addBreadcrumb(ex.getMessage());
// Sentry.addBreadcrumb(ex.getMessage());
LOGGER.error(SENTRY_ONLY, "Failed to launch instance.", cause != null ? cause : ex);

String message = ex.getMessage();
Expand Down
34 changes: 17 additions & 17 deletions vue.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const path = require('path');
const SentryWebpackPlugin = require('@sentry/webpack-plugin');
// const SentryWebpackPlugin = require('@sentry/webpack-plugin');
const {globSync} = require("glob");
const fs = require('fs');
const {execSync} = require('child_process');
Expand All @@ -9,22 +9,22 @@ const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf-8'));

const webpackPlugins = [];

if (process.env.GITHUB_REF_NAME) {
webpackPlugins.push(
new SentryWebpackPlugin({
authToken: process.env.SENTRY_AUTH_TOKEN,
org: 'creeperhost',
project: 'ftb-app',
release: `${packageJson.version}`,
dist: process.env.APP_TARGET_PLATFORM ?? "unknown",
include: process.env.TARGET_PLATFORM === 'overwolf' ? './overwolf/dist/desktop/' : './dist_electron/bundled/',
ignore: ['node_modules', 'webpack.config.js'],
urlPrefix: process.env.TARGET_PLATFORM === 'overwolf'
? `overwolf-extension://cmogmmciplgmocnhikmphehmeecmpaggknkjlbag/dist/desktop/`
: "ftb://./"
}),
);
}
// if (process.env.GITHUB_REF_NAME) {
// webpackPlugins.push(
// new SentryWebpackPlugin({
// authToken: process.env.SENTRY_AUTH_TOKEN,
// org: 'creeperhost',
// project: 'ftb-app',
// release: `${packageJson.version}`,
// dist: process.env.APP_TARGET_PLATFORM ?? "unknown",
// include: process.env.TARGET_PLATFORM === 'overwolf' ? './overwolf/dist/desktop/' : './dist_electron/bundled/',
// ignore: ['node_modules', 'webpack.config.js'],
// urlPrefix: process.env.TARGET_PLATFORM === 'overwolf'
// ? `overwolf-extension://cmogmmciplgmocnhikmphehmeecmpaggknkjlbag/dist/desktop/`
// : "ftb://./"
// }),
// );
// }

// This is required, the amount of times the IDE will import this just for using the variable is insane
if (process.env.GITHUB_REF_NAME) {
Expand Down

0 comments on commit 58bf172

Please sign in to comment.