HomeSoftware Heritage

Add a few statsd metrics in the kafka journal client

Description

Add a few statsd metrics in the kafka journal client

namely add 2 metrics:

  • swh_journal_client_handle_message_total: (counter) the total number of kafka messages that have been handled by the client,
  • swh_journal_client_status: (gauge) report the current status of the kafka consumer (waiting or processing).

Since these metrics will be created by any kafka consumer (any swh.journal.client), tags should be added to the statsd metrics (eg. via the STATS_TAGS env var) to distinguish between the different types of consumers (e.g. hostname, consumer type/role, etc.)

Especially for the swh_journal_client_status to work properly
in an elastic execution environment (docker swarm, k8s, ...) it is
mandatory to add a consumer-specific tag (e.g. the hostname) and make
sure the TTL for the metrics in prometherus-statsd-exporter is pretty
short (e.g. 1h), so that restarted consumers are not kept for too long/forever by statsd-exporter.

Details

Provenance
douarddaAuthored on Jan 13 2022, 3:53 PM
douarddaPushed on Jan 21 2022, 11:29 AM
Differential Revision
D6944: Add a few statsd metrics in the kafka journal client
Parents
rDJNL5b17c50d3280: Add support for the rdkafka 'stats_cb' config option in get_journal_client
Branches
Unknown
Tags
Unknown
References
tag: v1.0.0
Build Status
Buildable 26237
Build 41016: test-and-buildJenkins console · Jenkins