Skip to content

Commit

Permalink
add some metrics about rate
Browse files Browse the repository at this point in the history
  • Loading branch information
lirenzuo committed Feb 3, 2021
1 parent da2d5d8 commit 388db5c
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 31 deletions.
19 changes: 11 additions & 8 deletions exporter_overview.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,17 @@ var (
overviewLabels = []string{"cluster"}

overviewMetricDescription = map[string]*prometheus.GaugeVec{
"object_totals.channels": newGaugeVec("channels", "Number of channels.", overviewLabels),
"object_totals.connections": newGaugeVec("connections", "Number of connections.", overviewLabels),
"object_totals.consumers": newGaugeVec("consumers", "Number of message consumers.", overviewLabels),
"object_totals.queues": newGaugeVec("queues", "Number of queues in use.", overviewLabels),
"object_totals.exchanges": newGaugeVec("exchanges", "Number of exchanges in use.", overviewLabels),
"queue_totals.messages": newGaugeVec("queue_messages_global", "Number ready and unacknowledged messages in cluster.", overviewLabels),
"queue_totals.messages_ready": newGaugeVec("queue_messages_ready_global", "Number of messages ready to be delivered to clients.", overviewLabels),
"queue_totals.messages_unacknowledged": newGaugeVec("queue_messages_unacknowledged_global", "Number of messages delivered to clients but not yet acknowledged.", overviewLabels),
"object_totals.channels": newGaugeVec("channels", "Number of channels.", overviewLabels),
"object_totals.connections": newGaugeVec("connections", "Number of connections.", overviewLabels),
"object_totals.consumers": newGaugeVec("consumers", "Number of message consumers.", overviewLabels),
"object_totals.queues": newGaugeVec("queues", "Number of queues in use.", overviewLabels),
"object_totals.exchanges": newGaugeVec("exchanges", "Number of exchanges in use.", overviewLabels),
"queue_totals.messages": newGaugeVec("queue_messages_global", "Number ready and unacknowledged messages in cluster.", overviewLabels),
"queue_totals.messages_ready": newGaugeVec("queue_messages_ready_global", "Number of messages ready to be delivered to clients.", overviewLabels),
"queue_totals.messages_unacknowledged": newGaugeVec("queue_messages_unacknowledged_global", "Number of messages delivered to clients but not yet acknowledged.", overviewLabels),
"message_stats.publish_details.rate": newGaugeVec("messages_publish_rate", "Rate at which messages are entering the server.", overviewLabels),
"message_stats.deliver_no_ack_details.rate": newGaugeVec("messages_deliver_no_ack_rate", "Rate at which messages are delivered to consumers that use automatic acknowledgements.", overviewLabels),
"message_stats.deliver_details.rate": newGaugeVec("messages_deliver_rate", "Rate at which messages are delivered to consumers that use manual acknowledgements.", overviewLabels),
}

rabbitmqVersionMetric = prometheus.NewGaugeVec(
Expand Down
49 changes: 26 additions & 23 deletions exporter_queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,32 @@ var (
queueLabelKeys = []string{"vhost", "name", "durable", "policy", "state", "node", "idle_since"}

queueGaugeVec = map[string]*prometheus.GaugeVec{
"messages_ready": newGaugeVec("queue_messages_ready", "Number of messages ready to be delivered to clients.", queueLabels),
"messages_unacknowledged": newGaugeVec("queue_messages_unacknowledged", "Number of messages delivered to clients but not yet acknowledged.", queueLabels),
"messages": newGaugeVec("queue_messages", "Sum of ready and unacknowledged messages (queue depth).", queueLabels),
"messages_ready_ram": newGaugeVec("queue_messages_ready_ram", "Number of messages from messages_ready which are resident in ram.", queueLabels),
"messages_unacknowledged_ram": newGaugeVec("queue_messages_unacknowledged_ram", "Number of messages from messages_unacknowledged which are resident in ram.", queueLabels),
"messages_ram": newGaugeVec("queue_messages_ram", "Total number of messages which are resident in ram.", queueLabels),
"messages_persistent": newGaugeVec("queue_messages_persistent", "Total number of persistent messages in the queue (will always be 0 for transient queues).", queueLabels),
"message_bytes": newGaugeVec("queue_message_bytes", "Sum of the size of all message bodies in the queue. This does not include the message properties (including headers) or any overhead.", queueLabels),
"message_bytes_ready": newGaugeVec("queue_message_bytes_ready", "Like message_bytes but counting only those messages ready to be delivered to clients.", queueLabels),
"message_bytes_unacknowledged": newGaugeVec("queue_message_bytes_unacknowledged", "Like message_bytes but counting only those messages delivered to clients but not yet acknowledged.", queueLabels),
"message_bytes_ram": newGaugeVec("queue_message_bytes_ram", "Like message_bytes but counting only those messages which are in RAM.", queueLabels),
"message_bytes_persistent": newGaugeVec("queue_message_bytes_persistent", "Like message_bytes but counting only those messages which are persistent.", queueLabels),
"consumers": newGaugeVec("queue_consumers", "Number of consumers.", queueLabels),
"consumer_utilisation": newGaugeVec("queue_consumer_utilisation", "Fraction of the time (between 0.0 and 1.0) that the queue is able to immediately deliver messages to consumers. This can be less than 1.0 if consumers are limited by network congestion or prefetch count.", queueLabels),
"memory": newGaugeVec("queue_memory", "Bytes of memory consumed by the Erlang process associated with the queue, including stack, heap and internal structures.", queueLabels),
"head_message_timestamp": newGaugeVec("queue_head_message_timestamp", "The timestamp property of the first message in the queue, if present. Timestamps of messages only appear when they are in the paged-in state.", queueLabels), //https://github.com/rabbitmq/rabbitmq-server/pull/54
"arguments.x-max-length-bytes": newGaugeVec("queue_max_length_bytes", "Total body size for ready messages a queue can contain before it starts to drop them from its head.", queueLabels),
"arguments.x-max-length": newGaugeVec("queue_max_length", "How many (ready) messages a queue can contain before it starts to drop them from its head.", queueLabels),
"garbage_collection.min_heap_size": newGaugeVec("queue_gc_min_heap", "Minimum heap size in words", queueLabels),
"garbage_collection.min_bin_vheap_size": newGaugeVec("queue_gc_min_vheap", "Minimum binary virtual heap size in words", queueLabels),
"garbage_collection.fullsweep_after": newGaugeVec("queue_gc_collections_before_fullsweep", "Maximum generational collections before fullsweep", queueLabels),
"slave_nodes_len": newGaugeVec("queue_slaves_nodes_len", "Number of slave nodes attached to the queue", queueLabels),
"synchronised_slave_nodes_len": newGaugeVec("queue_synchronised_slave_nodes_len", "Number of slave nodes in sync to the queue", queueLabels),
"messages_ready": newGaugeVec("queue_messages_ready", "Number of messages ready to be delivered to clients.", queueLabels),
"messages_unacknowledged": newGaugeVec("queue_messages_unacknowledged", "Number of messages delivered to clients but not yet acknowledged.", queueLabels),
"messages": newGaugeVec("queue_messages", "Sum of ready and unacknowledged messages (queue depth).", queueLabels),
"messages_ready_ram": newGaugeVec("queue_messages_ready_ram", "Number of messages from messages_ready which are resident in ram.", queueLabels),
"messages_unacknowledged_ram": newGaugeVec("queue_messages_unacknowledged_ram", "Number of messages from messages_unacknowledged which are resident in ram.", queueLabels),
"messages_ram": newGaugeVec("queue_messages_ram", "Total number of messages which are resident in ram.", queueLabels),
"messages_persistent": newGaugeVec("queue_messages_persistent", "Total number of persistent messages in the queue (will always be 0 for transient queues).", queueLabels),
"message_bytes": newGaugeVec("queue_message_bytes", "Sum of the size of all message bodies in the queue. This does not include the message properties (including headers) or any overhead.", queueLabels),
"message_bytes_ready": newGaugeVec("queue_message_bytes_ready", "Like message_bytes but counting only those messages ready to be delivered to clients.", queueLabels),
"message_bytes_unacknowledged": newGaugeVec("queue_message_bytes_unacknowledged", "Like message_bytes but counting only those messages delivered to clients but not yet acknowledged.", queueLabels),
"message_bytes_ram": newGaugeVec("queue_message_bytes_ram", "Like message_bytes but counting only those messages which are in RAM.", queueLabels),
"message_bytes_persistent": newGaugeVec("queue_message_bytes_persistent", "Like message_bytes but counting only those messages which are persistent.", queueLabels),
"consumers": newGaugeVec("queue_consumers", "Number of consumers.", queueLabels),
"consumer_utilisation": newGaugeVec("queue_consumer_utilisation", "Fraction of the time (between 0.0 and 1.0) that the queue is able to immediately deliver messages to consumers. This can be less than 1.0 if consumers are limited by network congestion or prefetch count.", queueLabels),
"memory": newGaugeVec("queue_memory", "Bytes of memory consumed by the Erlang process associated with the queue, including stack, heap and internal structures.", queueLabels),
"head_message_timestamp": newGaugeVec("queue_head_message_timestamp", "The timestamp property of the first message in the queue, if present. Timestamps of messages only appear when they are in the paged-in state.", queueLabels), //https://github.com/rabbitmq/rabbitmq-server/pull/54
"arguments.x-max-length-bytes": newGaugeVec("queue_max_length_bytes", "Total body size for ready messages a queue can contain before it starts to drop them from its head.", queueLabels),
"arguments.x-max-length": newGaugeVec("queue_max_length", "How many (ready) messages a queue can contain before it starts to drop them from its head.", queueLabels),
"garbage_collection.min_heap_size": newGaugeVec("queue_gc_min_heap", "Minimum heap size in words", queueLabels),
"garbage_collection.min_bin_vheap_size": newGaugeVec("queue_gc_min_vheap", "Minimum binary virtual heap size in words", queueLabels),
"garbage_collection.fullsweep_after": newGaugeVec("queue_gc_collections_before_fullsweep", "Maximum generational collections before fullsweep", queueLabels),
"slave_nodes_len": newGaugeVec("queue_slaves_nodes_len", "Number of slave nodes attached to the queue", queueLabels),
"synchronised_slave_nodes_len": newGaugeVec("queue_synchronised_slave_nodes_len", "Number of slave nodes in sync to the queue", queueLabels),
"message_stats.publish_details.rate": newGaugeVec("queue_messages_publish_rate", "Rate at which messages are entering the server.", overviewLabels),
"message_stats.deliver_no_ack_details.rate": newGaugeVec("queue_messages_deliver_no_ack_rate", "Rate at which messages are delivered to consumers that use automatic acknowledgements.", overviewLabels),
"message_stats.deliver_details.rate": newGaugeVec("queue_messages_deliver_rate", "Rate at which messages are delivered to consumers that use manual acknowledgements.", overviewLabels),
}

queueCounterVec = map[string]*prometheus.Desc{
Expand Down

0 comments on commit 388db5c

Please sign in to comment.