Confluent-kafka-dotnet: StatisticsHandler topic is empty

Created on 8 Apr 2019  路  3Comments  路  Source: confluentinc/confluent-kafka-dotnet

Description

hey, i tried to use the adminclient to get statistics but the "topic" property ist empty,
what i am doing wrong or is this a bug ?

image

How to reproduce

public class KafkaTest
    {

        public KafkaTest()
        {
            var config = new AdminClientConfig()
            {
                ClientId = "admin-client-stats",
                BootstrapServers = Configuration.KafkaBootstrapServer,
                StatisticsIntervalMs = 10000,
                Debug = "broker,topic,msg"
            };

            var adminClient = new AdminClientBuilder(config)
                .SetStatisticsHandler(StatsHandler)
                .Build();
        }

        private void StatsHandler(AdminClient sender, string json)
        {
            Console.WriteLine(json);
        }
    }

Checklist

Please provide the following information:

  • [x] A complete (i.e. we can run it), minimal program demonstrating the problem. No need to supply a project file.
  • [x] Confluent.Kafka nuget version. (1.0.0-RC3)
  • [x] Apache Kafka version. (0.9.0.1)
  • [x] Client configuration.
  • [x] Operating system. ( win10, x64)
  • [ ] Provide logs (with "debug" : "..." as necessary in configuration).
  • [ ] Provide broker log excerpts.
  • [ ] Critical issue.
question

Most helpful comment

is there an another way to get the consumer lag for specific (or all) groups ?

All 3 comments

the admin client doesn't read/write to topics, so there is nothing to report. this will be populated on producers/consumers only.

i also tried a consumer and got the same result ( topic empty )

(didnt have the code actually, so free from the head... )

public class KafkaTest
    {

        public KafkaTest()
        {
            var config = new ConsumerConfig()
            {
                GroupId = "<service-name>",
                BootstrapServers = Configuration.KafkaBootstrapServer,
                StatisticsIntervalMs = 10000
            };

            var consumer = new ConsumerBuilder<TKey,TValue>(config)
                .SetStatisticsHandler(StatsHandler)
        .Set....();
                .Build();


      consumer.Subscribe("<my-topic>");
      while(true){
        var logEntry = consumer.Consume();
        .....
      }
        }   

        private void StatsHandler(Consumer<TKey,TValue> sender, string json)
        {
            Console.WriteLine(json);
        }
    }

is there an another way to get the consumer lag for specific (or all) groups ?

Was this page helpful?
0 / 5 - 0 ratings