MonolithWIKI
1.21.11 aktiv
MONOLITH WIKI

Monolith API

Optionale, read-only Betriebsdaten für Plugins – Paper-APIs bleiben der Standard.

Einstiegspunkt

APIMonolithRuntime Monolith.runtime()

Liefert den registrierten Runtime-Service oder wirft IllegalStateException, wenn er nicht verfügbar ist.

Rückgabe MonolithRuntime
APIMonolithDiagnostics Monolith.diagnostics()

Liefert den Diagnose-Service oder wirft IllegalStateException, wenn er nicht verfügbar ist.

Rückgabe MonolithDiagnostics
java
import dev.monolith.api.Monolith;
import dev.monolith.api.RuntimeSnapshot;

RuntimeSnapshot snapshot = Monolith.runtime().snapshot();
double p95 = snapshot.p95Mspt();
int health = Monolith.runtime().health().score();

MonolithRuntime

APIRuntimeSnapshot snapshot()

Neueste unveränderliche Runtime-Stichprobe.

Rückgabe RuntimeSnapshot
APIHealthAssessment health()

Transparente Health-Bewertung mit Score, Band und allen Abzügen.

Rückgabe HealthAssessment
APIAdaptiveState adaptiveState()

NORMAL, CONSTRAINED, RECOVERING oder DISABLED.

Rückgabe AdaptiveState
APIRuntimeProfile profile()

Aktuelles oder zuletzt abgeschlossenes begrenztes Pluginprofil.

Rückgabe RuntimeProfile
APIAllocationProfile allocationProfile()

Allokationsevidenz des expliziten Profils samt Messqualität.

Rückgabe AllocationProfile
APIvoid startProfile(int durationSeconds)

Startet ein Profil für 5–300 Sekunden; außerhalb des Bereichs folgt IllegalArgumentException.

APIvoid stopProfile()

Stoppt das Profil und behält den gesammelten Snapshot.

RuntimeSnapshot

Der Record enthält Zeit, Uptime, TPS 1/5/15, vollständige MSPT-Perzentile, Spieler, Chunks, Entitäten, Heap, GC, Allokation, CPU, Threads, Netzwerk, Chunk-Lifecycles sowie Hotpath-Millisekunden und -Aufrufe. Nicht verfügbare numerische Metriken sind -1 oder NaN gemäß Feldvertrag.

APIdouble tickBudgetUsed()

Average MSPT geteilt durch das 50-ms-Tickbudget.

Rückgabe double
APITickBudgetClass tickBudgetClass()

Klassifiziert Average MSPT in EXCELLENT, HEALTHY, HEAVY, SATURATED, OVER_BUDGET oder SEVERE.

Rückgabe TickBudgetClass

Diagnose-API

APIDiagnosticReport analyze(Throwable throwable, DiagnosticContext context)

Analysiert und persistiert den Originalfehler mit nicht sensiblem Kontext.

Rückgabe DiagnosticReport
APIList<DiagnosticReport> recent(int limit)

Liefert die jüngsten Berichte zuerst.

Rückgabe List<DiagnosticReport>
java
try {
    runOperation();
} catch (Throwable throwable) {
    var context = DiagnosticContext.plugin("MyPlugin", "cache refresh");
    DiagnosticReport report = Monolith.diagnostics().analyze(throwable, context);
    logger.warning("Monolith error ID: " + report.errorId());
}

Messqualität

WertBedeutungVerwendung
EXACTJedes Ereignis an der Grenze gezähltDirekte Zähler
SAMPLEDPeriodische BeobachtungRuntime-Stichproben
ESTIMATEDModell oder indirekte ZählerExplizit kennzeichnen
UNAVAILABLEKein belastbarer WertNicht durch Null ersetzen