Metric collection
BookKeeper enables metrics collection through a variety of stats providers.
Stats providers
BookKeeper has stats provider implementations for these sinks:
| Provider | Provider class name | 
|---|---|
| Codahale Metrics | org.apache.bookkeeper.stats.CodahaleMetricsProvider | 
| OpenTelemetry | org.apache.bookkeeper.stats.otel.OtelMetricsProvider | 
| Prometheus | org.apache.bookkeeper.stats.prometheus.PrometheusMetricsProvider | 
The Prometheus stats provider is the default provider.
Enabling stats providers in bookies
Two stats-related configuration parameters are available for bookies:
| Parameter | Description | Default | 
|---|---|---|
| enableStatistics | Whether statistics are enabled for the bookie | false | 
| sanityCheckMetricsEnabled | Flag to enable sanity check metrics in bookie stats | false | 
| statsProviderClass | The stats provider class used by the bookie | org.apache.bookkeeper.stats.CodahaleMetricsProvider | 
To enable stats:
- set the enableStatisticsparameter totrue
- set statsProviderClassto the desired provider (see the table above for a listing of classes)