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 CounterA count that only goes up – requests served, jobs run, errors seen.
class GaugeA value read when metrics are collected – a queue’s depth, a pool’s size, a @ManagedAttribute.
class HistogramA distribution of values – durations, sizes – kept as counts per bucket.
class InstrumentOne named measurement: a counter, a gauge or a histogram.
interface MetricReaderSomething that reads Metrics periodically and sends them somewhere – the OTLP exporter.
class MetricsThe server’s metrics: every Instrument by name, and the ones the server records about itself.