forked from lavalink-devs/Lavalink
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request lavalink-devs#97 from napstr/updates
Updates
- Loading branch information
Showing
9 changed files
with
104 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM openjdk:9-jre-slim | ||
FROM openjdk:10-jre-slim | ||
|
||
WORKDIR /opt/Lavalink | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
LavalinkServer/src/main/java/lavalink/server/config/SentryConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
package lavalink.server.config; | ||
|
||
import ch.qos.logback.classic.Level; | ||
import ch.qos.logback.classic.LoggerContext; | ||
import ch.qos.logback.classic.filter.ThresholdFilter; | ||
import io.sentry.Sentry; | ||
import io.sentry.SentryClient; | ||
import io.sentry.logback.SentryAppender; | ||
import lavalink.server.Launcher; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
import java.io.IOException; | ||
import java.util.Properties; | ||
|
||
/** | ||
* Created by napster on 25.04.18. | ||
*/ | ||
@Configuration | ||
public class SentryConfiguration { | ||
|
||
private static final Logger log = LoggerFactory.getLogger(SentryConfiguration.class); | ||
private static final String SENTRY_APPENDER_NAME = "SENTRY"; | ||
|
||
public SentryConfiguration(ServerConfig serverConfig) { | ||
String sentryDsn = serverConfig.getSentryDsn(); | ||
if (sentryDsn != null && !sentryDsn.isEmpty()) { | ||
turnOn(sentryDsn); | ||
} else { | ||
turnOff(); | ||
} | ||
} | ||
|
||
|
||
public void turnOn(String dsn) { | ||
log.info("Turning on sentry"); | ||
SentryClient sentryClient = Sentry.init(dsn); | ||
|
||
// set the git commit hash this was build on as the release | ||
Properties gitProps = new Properties(); | ||
try { | ||
gitProps.load(Launcher.class.getClassLoader().getResourceAsStream("git.properties")); | ||
} catch (NullPointerException | IOException e) { | ||
log.error("Failed to load git repo information", e); | ||
} | ||
|
||
String commitHash = gitProps.getProperty("git.commit.id"); | ||
if (commitHash != null && !commitHash.isEmpty()) { | ||
log.info("Setting sentry release to commit hash {}", commitHash); | ||
sentryClient.setRelease(commitHash); | ||
} else { | ||
log.warn("No git commit hash found to set up sentry release"); | ||
} | ||
|
||
getSentryLogbackAppender().start(); | ||
} | ||
|
||
public void turnOff() { | ||
log.warn("Turning off sentry"); | ||
Sentry.close(); | ||
getSentryLogbackAppender().stop(); | ||
} | ||
|
||
//programmatically creates a sentry appender | ||
private static synchronized SentryAppender getSentryLogbackAppender() { | ||
LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory(); | ||
ch.qos.logback.classic.Logger root = loggerContext.getLogger(Logger.ROOT_LOGGER_NAME); | ||
|
||
SentryAppender sentryAppender = (SentryAppender) root.getAppender(SENTRY_APPENDER_NAME); | ||
if (sentryAppender == null) { | ||
sentryAppender = new SentryAppender(); | ||
sentryAppender.setName(SENTRY_APPENDER_NAME); | ||
|
||
ThresholdFilter warningsOrAboveFilter = new ThresholdFilter(); | ||
warningsOrAboveFilter.setLevel(Level.WARN.levelStr); | ||
warningsOrAboveFilter.start(); | ||
sentryAppender.addFilter(warningsOrAboveFilter); | ||
|
||
sentryAppender.setContext(loggerContext); | ||
root.addAppender(sentryAppender); | ||
} | ||
return sentryAppender; | ||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-all.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |