You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by mm...@apache.org on 2022/07/28 21:49:31 UTC

[pulsar] branch branch-2.10 updated: [Broker] Expose topic level storage write and read rate metrics (#16855)

This is an automated email from the ASF dual-hosted git repository.

mmarshall pushed a commit to branch branch-2.10
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/branch-2.10 by this push:
     new 6aaff4e8c86 [Broker] Expose topic level storage write and read rate metrics (#16855)
6aaff4e8c86 is described below

commit 6aaff4e8c8667a9cf6921b8c4a89a0276b9a6bd8
Author: Michael Marshall <mm...@apache.org>
AuthorDate: Thu Jul 28 16:43:39 2022 -0500

    [Broker] Expose topic level storage write and read rate metrics (#16855)
    
    ### Motivation
    
    We collect metrics on storage read/write rate, but we do not expose it at the topic level. We already expose it at the namespace level.
    
    ### Modifications
    
    * Expose `pulsar_storage_read_rate` and `pulsar_storage_write_rate` in topic level metrics
    
    ### Verifying this change
    
    This change is a trivial rework / code cleanup without any test coverage.
    
    ### Does this pull request potentially affect one of the following parts:
    
    This change adds two new metrics.
    
    ### Documentation
    
    - [x] `doc-not-needed`
    
    These two metrics are already documented for topic level stats: https://pulsar.apache.org/docs/next/reference-metrics.
    
    (cherry picked from commit 23b52e47f227e0ee5fc9516083c59af4ad2d19f3)
---
 .../java/org/apache/pulsar/broker/stats/prometheus/TopicStats.java    | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/stats/prometheus/TopicStats.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/stats/prometheus/TopicStats.java
index 46be437eb23..ef645caa700 100644
--- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/stats/prometheus/TopicStats.java
+++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/stats/prometheus/TopicStats.java
@@ -133,6 +133,10 @@ class TopicStats {
                 stats.managedLedgerStats.storageLogicalSize, splitTopicAndPartitionIndexLabel);
         metric(stream, cluster, namespace, topic, "pulsar_msg_backlog", stats.msgBacklog,
                 splitTopicAndPartitionIndexLabel);
+        metric(stream, cluster, namespace, topic, "pulsar_storage_write_rate",
+                stats.managedLedgerStats.storageWriteRate, splitTopicAndPartitionIndexLabel);
+        metric(stream, cluster, namespace, topic, "pulsar_storage_read_rate", stats.managedLedgerStats.storageReadRate,
+                splitTopicAndPartitionIndexLabel);
         metric(stream, cluster, namespace, topic, "pulsar_storage_backlog_size",
                 stats.managedLedgerStats.backlogSize, splitTopicAndPartitionIndexLabel);
         metric(stream, cluster, namespace, topic, "pulsar_publish_rate_limit_times", stats.publishRateLimitedTimes,