Skip to main content

Application Monitoring

This page explains the Monitoring API that can be interacted with by applications, for a general overview of monitoring and screenshots of where this data is shown in Grafana, see Monitoring.

Readiness Monitoring

The Readiness of an application can be conveyed using the following:

    session.readinessStatus(ReadinessState.READY);

Application Custom Status

Custom application status information can be conveyed using the following:

    session.applicationCustomStatus("Data", ApplicationCustomState.OK, "Subscription completed");

Custom Application Histograms

The ability to implement and record histograms is built into the KeySquare API natively. Histograms allow the recording of numerical data into buckets. KeySquare primarily uses this to record the time taken to perform an action.

    Histogram histogram = session.createHistogram("CurveGenLatency");
...
final long now = nanoClock.nanoTimeSinceEpoch();
// thing to measure
curveGenerator.generate();
final long processingTime = nanoClock.nanoTimeSinceEpoch() - now;

histogram.recordValue(processingTime);

This histogram object should be reused once created, this produces a time-series histogram.

Custom Application Counters

Counters are another feature provided within the KeySquare API and visible through our monitoring in Grafana.

    Counter instrumentCount = session.createCounter("InstrumentCount");
instrumentCount.increment();