permutive-engineering / prometheus4cats-contrib   2.1.0

Apache License 2.0 GitHub

Prometheus4Cats instumentation for thrid party libaries

Scala versions: 3.x 2.13 2.12

Prometheus4Cats Contrib

This repository contains a series of integrations for Prometheus4Cats that instrument other libraries or metric sources. Each integration is documented below:


Google Bigtable Java client instrumentation. Uses a Prometheus4Cats callback registry to inspect the client metrics registered with OpenCensus.

Use the BigtableOpenCensusMetrics smart constructor to enable metric collection on the Java client and registering them with a MetricFactory.WithCallbacks.

"com.permutive" %% "prometheus4cats-contrib-google-cloud-bigtable" % "<VERSION>"


Cats-Effect metrics taken from JMX MBeans. This includes a CPU starvation counter.

Use the CatsEffectMBeans smart constructor register callbacks for Cats-Effect MBeans with MetricFactory.WithCallbacks.

"com.permutive" %% "prometheus4cats-contrib-cats-effect" % "<VERSION>"


FS2-Kafka integration that instruments consumers and producers. Uses a Prometheus4Cats callback registry to inspect built-in Kafka client metrics.

Use the smart constructors in KafkaMetrics to register callbacks for producers and consumers with a MetricFactory.WithCallbacks.

"com.permutive" %% "prometheus4cats-contrib-fs2-kafka" % "<VERSION>"


Instrumented implementation of Refreshable. Provides the following metrics:

Metric Name Labels Metric Type Description
refreshable_read_total refreshable_name, value_state Counter Number of times this Refreshable has been read, with a label denoting the state of the value
refreshable_is_running refreshable_name Gauge Whether this Refreshable is running - 1 if true, 0 if false
refreshable_retries_exhausted refreshable_name Gauge Whether retries have been exhausted for this Refreshable - 1 if true, 0 if false
refreshable_refresh_failing refreshable_name Gauge Whether refresh is currently failing - 1 if true, 0 if false
refreeshable_refresh_success_total refreshable_name Counter Number of times the refresh operation has succeeded
refreshable_refresh_failure_total refreshable_name Counter Number of times refresh failed
refreshable_status refreshable_name, value_state Gauge The current status of this Refreshable - a value of 1 against the label value indicates the current state

Use the InstrumentedRefreshable smart constructor to instrument a given Refreshable when used with an instance of MetricFactory.WithCallbacks.

"com.permutive" %% "prometheus4cats-contrib-refreshable" % "<VERSION>"


Instrumented implementations of Trace4Cats interfaces. Provides the following metrics:

Interface Metric Name Labels Metric Type Description
EntryPoint trace4cats_entry_point_spans_total span_kind, is_root, sample_decision Counter Total number of spans created
SpanCompleter trace4cats_completer_spans_total completer_name Counter Total number of spans completed
SpanCompleter trace4cats_completer_complete_time completer_name Histogram Time it takes to complete a span in seconds
SpanExporter trace4cats_exporter_batches_total exporter_name Counter Total number of batches sent via this exporter
SpanExporter trace4cats_exporter_export_time exporter_name Histogram Time it takes to export a span batch in seconds
SpanExporter trace4cats_exporter_batch_size exporter_name Histogram Size distribution of batches sent by this exporter

Use the InstrumentedEntrypoint, InstrumentedSpanCompleter and InstrumentedSpanExporter with a MetricFactory to return instrumented wrappers of the underlying implementations.

"com.permutive" %% "prometheus4cats-contrib-trace4cats" % "<VERSION>"