Class: Promenade::Kafka::ConnectionSubscriber
- Inherits:
-
Subscriber
- Object
- ActiveSupport::Subscriber
- Subscriber
- Promenade::Kafka::ConnectionSubscriber
- Defined in:
- lib/promenade/kafka/connection_subscriber.rb
Instance Method Summary collapse
-
#request(event) ⇒ Object
rubocop:disable Metrics/AbcSize.
Instance Method Details
#request(event) ⇒ Object
rubocop:disable Metrics/AbcSize
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/promenade/kafka/connection_subscriber.rb', line 29 def request(event) # rubocop:disable Metrics/AbcSize labels = { client: event.payload.fetch(:client_id), api: event.payload.fetch(:api, "unknown"), broker: event.payload.fetch(:broker_host), } Promenade.metric(:kafka_connection_calls).increment(labels) Promenade.metric(:kafka_connection_latency).observe(labels, event.duration) Promenade.metric(:kafka_connection_request_size).observe(labels, event.payload.fetch(:request_size, 0)) Promenade.metric(:kafka_connection_response_size).observe(labels, event.payload.fetch(:response_size, 0)) Promenade.metric(:kafka_connection_errors).increment(labels) if event.payload.key?(:exception) end |