Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.
package com.codename1.backend.metrics
Metrics for a backend: counters, gauges and histograms named after the OpenTelemetry semantic conventions.
Metrics holds every instrument in the process. The server records its own
– request durations, open connections, database pool use, scheduled runs –
and an application adds more through the Timed, Counted and
ManagedResource annotations, or by creating instruments directly. A
MetricReader takes them from there: the OTLP exporter in
com.codename1.backend.otel, or the management endpoints’ JSON and
Prometheus text.
Server code: this package is not available in the app.
Types
class Counter | A count that only goes up – requests served, jobs run, errors seen. |
class Gauge | A value read when metrics are collected – a queue’s depth, a pool’s size, a @ManagedAttribute. |
class Histogram | A distribution of values – durations, sizes – kept as counts per bucket. |
class Instrument | One named measurement: a counter, a gauge or a histogram. |
interface MetricReader | Something that reads Metrics periodically and sends them somewhere – the OTLP exporter. |
class Metrics | The server’s metrics: every Instrument by name, and the ones the server records about itself. |