Skip to content

Diagnostics

Reference for ConduitDiagnostics — every method, status value and counter, and what each one proves.

Obtained from the bus:

java
Conduit conduit = ConduitLoader.load(this);
ConduitDiagnostics diagnostics = conduit.events().diagnostics();

Nothing on this interface throws and nothing is expensive, so it is safe to poll from a command handler.

For the operator-facing version — symptoms, causes and fixes — see common issues. This page is the API reference.

The surface

java
List<SourcePlugin> providers();
ProviderStatus      status(SourcePlugin source);
long                forwarded(SourcePlugin source);
long                untranslatable(SourcePlugin source);
long                asynchronous(SourcePlugin source);
String              describeWhy(SourcePlugin source);
List<Report>        problems();

providers()

Every provider Conduit knows about, installed or not. Fixed size — a server missing eleven of fifteen still gets fifteen entries, so "absent" is distinguishable from "Conduit has never heard of this plugin". A stable iteration target.

status(SourcePlugin)

One of five values:

Status Meaning
ACTIVE Installed, and its events are being forwarded.
ABSENT Not installed.
NO_EVENTS Installed, but ships no usable events. Readiness is polled instead.
UNSUPPORTED_VERSION Installed, but this version's API does not match what Conduit expects.
LINKAGE_FAILED A specific binding could not be made — a renamed method, a missing class.

NO_EVENTS is cleared by a later event from the same provider. LINKAGE_FAILED is not: it records a specific failure, and a later event succeeding does not make that message untrue. It stands until the provider is re-probed.

forwarded(SourcePlugin)

Events that reached subscribers. Per provider rather than per event type, so it answers "is this adapter alive" cheaply.

untranslatable(SourcePlugin)

Events that fired but produced no Conduit event.

A separate counter from forwarded() on purpose. Without the split, a provider whose events fire and are all dropped is indistinguishable from a provider that is simply quiet. forwarded() == 0 with untranslatable() climbing means the provider works and Conduit cannot read it — version skew, not a dead server.

asynchronous(SourcePlugin)

Events that arrived off the main thread.

Read this before writing a handler:

  • Zero — every event was synchronous, so the handler runs on the primary server thread and may touch the Bukkit API directly.
  • Non-zero — check event.isAsynchronous() in the handler and hop threads yourself.

It answers "does this provider need thread-hopping" once at startup rather than making every handler defensive. Counted on every republish rather than latched, so a provider whose threading changes between loads shows up as a moving number instead of a stale verdict.

A DetachedBus — one built by hand with no provider behind it — reports zero for everything, because there is nothing behind it. Do not read that as an observation.

describeWhy(SourcePlugin)

A human-readable reason, or null for an unknown plugin. Log this first.

Before Conduit probes a provider it reads:

Conduit has not probed X yet. This is the initial state, not an observation.

Seeded rather than left null on purpose, so a consumer can tell "checked and missing" from "not looked at yet" without guessing.

problems()

Everything Conduit currently considers wrong, as Report entries — the aggregate view, rather than one string per provider. Check it on startup and log whatever comes back.

A startup report

java
@Override
public void onEnable() {
    Conduit conduit = ConduitLoader.load(this);
    ConduitDiagnostics diagnostics = conduit.events().diagnostics();

    diagnostics.problems().forEach(report ->
            getLogger().warning(report.toString()));

    conduit.events().onItem(event -> {
        if (event.isAsynchronous()) {
            // Off the main thread: schedule instead of touching the API here.
            Bukkit.getScheduler().runTask(this, () -> handle(event));
            return;
        }
        handle(event);
    });
}

Further reading

  • Coverage — the static table of what is forwarded, with reasons
  • Events — the thread contract in full