Skip to content

Conversation

@gerhard
Copy link
Contributor

@gerhard gerhard commented May 18, 2021

This is an important metric to keep track of and be aware (maybe even alert on) when consumers fall behind consuming stream messages. While they should be able to catch up, if they fall behind too much and the stream gets truncated, they may miss on messages.

This is something that we want to expose via Prometheus metrics as well, but we've started closer to the core, CLI & Management.

While at it, we've made the commands use PrettyTable by default.

This should be merged as soon as it passes CI, we shouldn't wait on the Prometheus changes - they can come later.

Pair: @kjnilsson

image
image

@gerhard gerhard requested a review from acogoluegnes May 18, 2021 11:30
@gerhard gerhard added this to the 3.9.0 milestone May 18, 2021
@gerhard gerhard force-pushed the streams-consumer-lag-metrics branch from fe80412 to 4fe64f6 Compare May 18, 2021 16:30
Copy link
Contributor

@acogoluegnes acogoluegnes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Failures in the rabbit_stream_queue test suite:

rabbit_stream_queue_SUITE > single_node_parallel > consume_from_relative_time_offset
    #1. {error,
            {{shutdown,
                 {server_initiated_close,406,
                     <<"PRECONDITION_FAILED - invalid arg 'x-stream-offset' for queue 'consume_from_relative_time_offset' in vhost '/': invalid_stream_offset_arg">>}},
             {gen_server,call,
                 [<0.963.0>,
                  {subscribe,
                      {'basic.consume',0,
                          <<"consume_from_relative_time_offset">>,<<"ctag">>,
                          false,false,false,false,
                          [{<<"x-stream-offset">>,longstr,<<"100s">>}]},
                      <0.534.0>},
                  infinity]}}}

rabbit_stream_queue_SUITE > cluster_size_2_parallel > consume_from_relative_time_offset
    #1. {error,
            {{shutdown,
                 {server_initiated_close,406,
                     <<"PRECONDITION_FAILED - invalid arg 'x-stream-offset' for queue 'consume_from_relative_time_offset' in vhost '/': invalid_stream_offset_arg">>}},
             {gen_server,call,
                 [<0.1873.0>,
                  {subscribe,
                      {'basic.consume',0,
                          <<"consume_from_relative_time_offset">>,<<"ctag">>,
                          false,false,false,false,
                          [{<<"x-stream-offset">>,longstr,<<"100s">>}]},
                      <0.1380.0>},
                  infinity]}}}

rabbit_stream_queue_SUITE > cluster_size_3_parallel > consume_from_relative_time_offset
    #1. {error,
            {{shutdown,
                 {server_initiated_close,406,
                     <<"PRECONDITION_FAILED - invalid arg 'x-stream-offset' for queue 'consume_from_relative_time_offset' in vhost '/': invalid_stream_offset_arg">>}},
             {gen_server,call,
                 [<0.3521.0>,
                  {subscribe,
                      {'basic.consume',0,
                          <<"consume_from_relative_time_offset">>,<<"ctag">>,
                          false,false,false,false,
                          [{<<"x-stream-offset">>,longstr,<<"100s">>}]},
                      <0.2758.0>},
                  infinity]}}}

@gerhard gerhard force-pushed the streams-consumer-lag-metrics branch 2 times, most recently from d4544a9 to f2463d5 Compare May 20, 2021 10:43
gerhard added 2 commits May 21, 2021 13:02
This is an important metric to keep track of and be aware (maybe even
alert on) when consumers fall behind consuming stream messages. While
they should be able to catch up, if they fall behind too much and the
stream gets truncated, they may miss on messages.

This is something that we want to expose via Prometheus metrics as well,
but we've started closer to the core, CLI & Management.

This should be merged as soon as it passes CI, we shouldn't wait on the
Prometheus changes - they can come later.

Pair: @kjnilsson

Signed-off-by: Gerhard Lazu <gerhard@lazu.co.uk>
Signed-off-by: Gerhard Lazu <gerhard@lazu.co.uk>
@gerhard gerhard force-pushed the streams-consumer-lag-metrics branch from fc1dd3b to 080b077 Compare May 21, 2021 12:03
@kjnilsson kjnilsson merged commit 03063f2 into master May 21, 2021
@gerhard gerhard deleted the streams-consumer-lag-metrics branch May 21, 2021 16:16
@fabiorosa-sn
Copy link

any idea on when this metric will be made available on prometheus ?

@michaelklishin
Copy link
Collaborator

@fabiorosa-sn this metric needs to be exposed in multiple places, for example, it is not actually exposed via CLI. rabbitmq_stream_management is the only place where it is exposed.

We do not make ETA promises. First step is usually expose something like this to rabbitmq-streams stream_status.

@johanrhodin
Copy link

@gomoripeti @markus812498 this might be something for us to contribute (the CLI + prometheus parts)

@markusgust
Copy link
Contributor

markusgust commented Nov 7, 2023

it looks like it's already exposed to the stream CLI. Can look and see if I can figure out how exposing to prometheus works:

➜  sbin git:(main) ./rabbitmq-streams list_stream_consumers
Listing stream consumers ...
┌─────────────────┬────────┬───────────────────┬─────────────┬────────────┬─────────┬────────┬─────────────────┬────────────┐
│ subscription_id │ stream │ messages_consumed │ offset      │ offset_lag │ credits │ active │ activity_status │ properties │
├─────────────────┼────────┼───────────────────┼─────────────┼────────────┼─────────┼────────┼─────────────────┼────────────┤
│ 0               │ stream │ 1573021579        │ 31484410142 │ 0          │ 0       │ true   │ up              │ #{}        │
├─────────────────┼────────┼───────────────────┼─────────────┼────────────┼─────────┼────────┼─────────────────┼────────────┤
│ 0               │ stream │ 1573021579        │ 31484410142 │ 0          │ 0       │ true   │ up              │ #{}        │
└─────────────────┴────────┴───────────────────┴─────────────┴────────────┴─────────┴────────┴─────────────────┴────────────┘

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants