mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-08-16 16:26:12 +00:00
add info about used commit to sentry reports
This commit is contained in:
parent
3949468a60
commit
e5f2fee926
@ -137,6 +137,14 @@ tasks {
|
|||||||
"version" to rootProject.version,
|
"version" to rootProject.version,
|
||||||
"apiVersion" to apiVersion,
|
"apiVersion" to apiVersion,
|
||||||
"main" to main,
|
"main" to main,
|
||||||
|
"environment" to if (project.hasProperty("release")) "production" else "development",
|
||||||
|
"commit" to provider {
|
||||||
|
ProcessBuilder("git", "rev-parse", "HEAD")
|
||||||
|
.redirectOutput(ProcessBuilder.Redirect.PIPE)
|
||||||
|
.start()
|
||||||
|
.inputStream.bufferedReader().readText().trim()
|
||||||
|
.takeIf { it.length == 40 } ?: "unknown"
|
||||||
|
}
|
||||||
)
|
)
|
||||||
filesMatching("**/plugin.yml") {
|
filesMatching("**/plugin.yml") {
|
||||||
expand(inputs.properties)
|
expand(inputs.properties)
|
||||||
|
@ -23,9 +23,11 @@ import org.bstats.charts.SimplePie;
|
|||||||
import org.bstats.charts.SingleLineChart;
|
import org.bstats.charts.SingleLineChart;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import oshi.SystemInfo;
|
import oshi.SystemInfo;
|
||||||
|
|
||||||
|
import java.io.InputStreamReader;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.text.NumberFormat;
|
import java.text.NumberFormat;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -45,6 +47,9 @@ public class Bindings {
|
|||||||
if (settings.disableAutoReporting || Sentry.isEnabled() || Boolean.getBoolean("iris.suppressReporting")) return;
|
if (settings.disableAutoReporting || Sentry.isEnabled() || Boolean.getBoolean("iris.suppressReporting")) return;
|
||||||
Iris.info("Enabling Sentry for anonymous error reporting. You can disable this in the settings.");
|
Iris.info("Enabling Sentry for anonymous error reporting. You can disable this in the settings.");
|
||||||
Iris.info("Your server ID is: " + ServerID.ID);
|
Iris.info("Your server ID is: " + ServerID.ID);
|
||||||
|
var resource = Iris.instance.getResource("plugin.yml");
|
||||||
|
YamlConfiguration desc = resource != null ? YamlConfiguration.loadConfiguration(new InputStreamReader(resource)) : new YamlConfiguration();
|
||||||
|
|
||||||
Sentry.init(options -> {
|
Sentry.init(options -> {
|
||||||
options.setDsn("https://b16ecc222e9c1e0c48faecacb906fd89@o4509451052646400.ingest.de.sentry.io/4509452722765904");
|
options.setDsn("https://b16ecc222e9c1e0c48faecacb906fd89@o4509451052646400.ingest.de.sentry.io/4509452722765904");
|
||||||
if (settings.debug) {
|
if (settings.debug) {
|
||||||
@ -55,6 +60,7 @@ public class Bindings {
|
|||||||
options.setAttachServerName(false);
|
options.setAttachServerName(false);
|
||||||
options.setEnableUncaughtExceptionHandler(false);
|
options.setEnableUncaughtExceptionHandler(false);
|
||||||
options.setRelease(Iris.instance.getDescription().getVersion());
|
options.setRelease(Iris.instance.getDescription().getVersion());
|
||||||
|
options.setEnvironment(desc.getString("environment", "production"));
|
||||||
options.setBeforeSend((event, hint) -> {
|
options.setBeforeSend((event, hint) -> {
|
||||||
if (suppress(event.getThrowable())) return null;
|
if (suppress(event.getThrowable())) return null;
|
||||||
event.setTag("iris.safeguard", IrisSafeguard.mode());
|
event.setTag("iris.safeguard", IrisSafeguard.mode());
|
||||||
@ -71,6 +77,7 @@ public class Bindings {
|
|||||||
scope.setTag("server", Bukkit.getVersion());
|
scope.setTag("server", Bukkit.getVersion());
|
||||||
scope.setTag("server.type", Bukkit.getName());
|
scope.setTag("server.type", Bukkit.getName());
|
||||||
scope.setTag("server.api", Bukkit.getBukkitVersion());
|
scope.setTag("server.api", Bukkit.getBukkitVersion());
|
||||||
|
scope.setTag("iris.commit", desc.getString("commit", "unknown"));
|
||||||
});
|
});
|
||||||
Runtime.getRuntime().addShutdownHook(new Thread(Sentry::close));
|
Runtime.getRuntime().addShutdownHook(new Thread(Sentry::close));
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,8 @@ load: STARTUP
|
|||||||
authors: [ cyberpwn, NextdoorPsycho, Vatuu ]
|
authors: [ cyberpwn, NextdoorPsycho, Vatuu ]
|
||||||
website: volmit.com
|
website: volmit.com
|
||||||
description: More than a Dimension!
|
description: More than a Dimension!
|
||||||
|
environment: '${environment}'
|
||||||
|
commit: '${commit}'
|
||||||
commands:
|
commands:
|
||||||
iris:
|
iris:
|
||||||
aliases: [ ir, irs ]
|
aliases: [ ir, irs ]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user