fix sentry safeguard info

This commit is contained in:
Julian Krings 2025-07-04 12:34:20 +02:00
parent 44af23ba2e
commit 77b4253624
No known key found for this signature in database
GPG Key ID: 208C6E08C3B718D2
2 changed files with 21 additions and 1 deletions

View File

@ -976,7 +976,7 @@ public class Iris extends VolmitPlugin implements Listener {
event.setTag("iris.nms", INMS.get().getClass().getCanonicalName());
var context = IrisContext.get();
if (context != null) event.getContexts().set("engine", context.asContext());
event.getContexts().set("safeguard", ServerBootSFG.allIncompatibilities);
event.getContexts().set("safeguard", IrisSafeguard.asContext());
return event;
});
});

View File

@ -2,6 +2,8 @@ package com.volmit.iris.core.safeguard;
import com.volmit.iris.Iris;
import com.volmit.iris.core.IrisSettings;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.collection.KMap;
import java.util.concurrent.atomic.AtomicBoolean;
@ -35,5 +37,23 @@ public class IrisSafeguard {
return "stable";
}
}
public static KMap<String, Object> asContext() {
KMap<String, Object> m = new KMap<>();
m.put("diskSpace", !ServerBootSFG.hasEnoughDiskSpace);
m.put("javaVersion", !ServerBootSFG.isCorrectJDK);
m.put("jre", ServerBootSFG.isJRE);
m.put("missingAgent", ServerBootSFG.missingAgent);
m.put("missingDimensionTypes", ServerBootSFG.missingDimensionTypes);
m.put("failedInjection", ServerBootSFG.failedInjection);
m.put("unsupportedVersion", ServerBootSFG.unsuportedversion);
m.put("serverSoftware", !ServerBootSFG.passedserversoftware);
KList<String> incompatiblePlugins = new KList<>();
ServerBootSFG.incompatibilities.forEach((plugin, present) -> {
if (present) incompatiblePlugins.add(plugin);
});
m.put("plugins", incompatiblePlugins);
return m;
}
}