Class MetricSchema

java.lang.Object
com.codename1.backend.metrics.MetricSchema

public final class MetricSchema extends Object

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(String, String).

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

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
    One instrument of the schema.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Measured by every runtime.
    static final String
    A value that only grows while the process runs, and starts again from zero when it restarts.
    static final String
    Measured when the server has a database pool.
    static final String
    A value read when the metrics are collected, which may rise or fall.
    static final String
    Measured on the JVM only; a packaged native server has no equivalent.
  • Method Summary

    Modifier and Type
    Method
    Description
    static Map
    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.
    static List
    Every instrument of the schema, in a fixed order.
    get(String name)
    The schema's instrument of this name, or null.
    static boolean
    Whether this process reports the instrument now: it is registered and, for a gauge without attributes, has its point to report.
    static String
    The runtime this process is: jvm or native.
    static List
    The Micrometer meters a Spring Boot dashboard may read that no runtime here reports, each as {meter, reason}.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • ALWAYS

      public static final String ALWAYS
      Measured by every runtime.
      See Also:
    • DATABASE

      public static final String DATABASE
      Measured when the server has a database pool.
      See Also:
    • JVM

      public static final String JVM
      Measured on the JVM only; a packaged native server has no equivalent.
      See Also:
    • CUMULATIVE

      public static final String CUMULATIVE
      A value that only grows while the process runs, and starts again from zero when it restarts. Rate and increase functions apply.
      See Also:
    • INSTANT

      public static final String INSTANT
      A value read when the metrics are collected, which may rise or fall.
      See Also:
  • 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.