<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: How can i fund the number of messages published to a kafka topic per hour in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/How-can-i-fund-the-number-of-messages-published-to-a-kafka/m-p/331345#M230865</link>
    <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/49640"&gt;@sarm&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After digging a little bit more, there is a metric exposed by producers called&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;kafka.producer:type=producer-metrics,client-id=producer-1 &amp;gt;&amp;nbsp;objectName&amp;nbsp;&lt;/P&gt;&lt;P&gt;record-send-total:&amp;nbsp;This will show the total number of records sent by this producer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To get more details about the available metrics in Kafka I would suggest checking &lt;A href="https://community.cloudera.com/t5/Community-Articles/How-to-obtain-the-list-of-available-metrics-for-Kafka/ta-p/331252" target="_self"&gt;this&lt;/A&gt; Cloudera community article.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 30 Nov 2021 17:48:25 GMT</pubDate>
    <dc:creator>ManuelCalvo</dc:creator>
    <dc:date>2021-11-30T17:48:25Z</dc:date>
    <item>
      <title>How can i fund the number of messages published to a kafka topic per hour</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-can-i-fund-the-number-of-messages-published-to-a-kafka/m-p/329969#M230562</link>
      <description>&lt;P&gt;Hi All ,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can i fund the number of messages published to a kafka topic per hour ?&lt;/P&gt;&lt;P&gt;When i got to grafana dashboard from ambari , i could see messages in/s ,does this metric give the number of messages at the time frame in kafka topic ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Nov 2021 15:47:01 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-can-i-fund-the-number-of-messages-published-to-a-kafka/m-p/329969#M230562</guid>
      <dc:creator>sarm</dc:creator>
      <dc:date>2021-11-10T15:47:01Z</dc:date>
    </item>
    <item>
      <title>Re: How can i fund the number of messages published to a kafka topic per hour</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-can-i-fund-the-number-of-messages-published-to-a-kafka/m-p/331005#M230801</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/49640"&gt;@sarm&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think there is no metric for that, on the other hand, you can create a simple java consumer and add the following details:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="java"&gt;// consumer details here

while (true) {
    try {
        ConsumerRecords&amp;lt;String, String&amp;gt; records = consumer.poll(Duration.ofMillis(100));


        for (ConsumerRecord&amp;lt;String, String&amp;gt; record : records) {
            Date date;
            System.out.println(date = new Date(record.timestamp()));
            System.out.printf("Partition = %d\n",record.partition());
            System.out.printf("Offset = %d\n", record.offset());
            System.out.printf("Key    = %s\n", record.key());
            System.out.printf("Value  = %s\n", record.value());
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}&lt;/LI-CODE&gt;&lt;P&gt;This should provide the following output:&lt;/P&gt;&lt;LI-CODE lang="java"&gt;Wed Nov 24 19:16:27 CLST 2021
Partition = 0
Offset = 439
Key = null
Value = S&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Then you can create some logic to count the number of messages between some specific timing.&lt;/P&gt;&lt;P&gt;I hope that helps.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Nov 2021 22:22:14 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-can-i-fund-the-number-of-messages-published-to-a-kafka/m-p/331005#M230801</guid>
      <dc:creator>ManuelCalvo</dc:creator>
      <dc:date>2021-11-24T22:22:14Z</dc:date>
    </item>
    <item>
      <title>Re: How can i fund the number of messages published to a kafka topic per hour</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-can-i-fund-the-number-of-messages-published-to-a-kafka/m-p/331345#M230865</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/49640"&gt;@sarm&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After digging a little bit more, there is a metric exposed by producers called&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;kafka.producer:type=producer-metrics,client-id=producer-1 &amp;gt;&amp;nbsp;objectName&amp;nbsp;&lt;/P&gt;&lt;P&gt;record-send-total:&amp;nbsp;This will show the total number of records sent by this producer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To get more details about the available metrics in Kafka I would suggest checking &lt;A href="https://community.cloudera.com/t5/Community-Articles/How-to-obtain-the-list-of-available-metrics-for-Kafka/ta-p/331252" target="_self"&gt;this&lt;/A&gt; Cloudera community article.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Nov 2021 17:48:25 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-can-i-fund-the-number-of-messages-published-to-a-kafka/m-p/331345#M230865</guid>
      <dc:creator>ManuelCalvo</dc:creator>
      <dc:date>2021-11-30T17:48:25Z</dc:date>
    </item>
  </channel>
</rss>

