Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.

public final class MetricSchema

  1. Object
  2. MetricSchema

The published schema of the metrics the server records about itself: each one’s name, kind, unit, attributes and lifecycle, the runtimes that measure it, and the Micrometer meter a Spring Boot dashboard reads for the same figure. The names, units and attributes listed here are stable; a dashboard or alert written against them keeps working across releases and across the JVM and the packaged native server.

A figure a runtime cannot measure is never reported as zero there. Its instrument is not registered, or – for a pool gauge on a server with no database – reports no point, so it is absent from every view, and describe lists it as unavailable with the reason. The Micrometer meters neither runtime has an equivalent for are listed by unmeasured.

GET /manage/schema serves describe for the running server.

Nested types

class MetricSchema.EntryOne instrument of the schema.

Fields

public static final String ALWAYS = "always"Measured by every runtime.
public static final String DATABASE = "database"Measured when the server has a database pool.
public static final String JVM = "jvm"Measured on the JVM only; a packaged native server has no equivalent.
public static final String CUMULATIVE = "cumulative"A value that only grows while the process runs, and starts again from zero when it restarts.
public static final String INSTANT = "instant"A value read when the metrics are collected, which may rise or fall.

Methods

public static List entries()Every instrument of the schema, in a fixed order.
public static MetricSchema.Entry get(String name)The schema’s instrument of this name, or null.
public static List unmeasured()The Micrometer meters a Spring Boot dashboard may read that no runtime here reports, each as {meter, reason}.
public static String runtime()The runtime this process is: jvm or native.
public static boolean isAvailable(MetricSchema.Entry entry)Whether this process reports the instrument now: it is registered and, for a gauge without attributes, has its point to report.
public static Map describe()The schema as the management endpoint serves it: the runtime, every instrument with whether this process reports it and, when it does not, why, and the Micrometer meters nothing here reports.

Inherited methods

Field details

ALWAYS

public static final String ALWAYS = "always"
Measured by every runtime.

DATABASE

public static final String DATABASE = "database"
Measured when the server has a database pool.

JVM

public static final String JVM = "jvm"
Measured on the JVM only; a packaged native server has no equivalent.

CUMULATIVE

public static final String CUMULATIVE = "cumulative"
A value that only grows while the process runs, and starts again from zero when it restarts. Rate and increase functions apply.

INSTANT

public static final String INSTANT = "instant"
A value read when the metrics are collected, which may rise or fall.

Method details

entries

public static List entries()
Every instrument of the schema, in a fixed order.

get

public static MetricSchema.Entry get(String name)
The schema’s instrument of this name, or null.

unmeasured

public static List unmeasured()
The Micrometer meters a Spring Boot dashboard may read that no runtime here reports, each as {meter, reason}.

runtime

public static String runtime()
The runtime this process is: jvm or native.

isAvailable

public static boolean isAvailable(MetricSchema.Entry entry)
Whether this process reports the instrument now: it is registered and, for a gauge without attributes, has its point to report. A gauge with attributes has a point per value – an executor, say – and none while there is no such value yet, which is a measured “none”. False for every instrument before a server has started.

describe

public static Map describe()
The schema as the management endpoint serves it: the runtime, every instrument with whether this process reports it and, when it does not, why, and the Micrometer meters nothing here reports.