Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No stats being printed to logs #682

Open
4 tasks done
coding-yogi opened this issue May 7, 2024 · 1 comment
Open
4 tasks done

No stats being printed to logs #682

coding-yogi opened this issue May 7, 2024 · 1 comment

Comments

@coding-yogi
Copy link

coding-yogi commented May 7, 2024

Description

I am using a custom context with below code

 struct CustomContext; 
 impl ConsumerContext for CustomContext {} 
 impl ClientContext for CustomContext { 
    fn stats(&self, statistics: rdkafka::Statistics) {
        log::info!("{:?}", statistics);                
    } 
} 

This context is then passed to create a BaseConsumer client . The statistics.interval.ms is being set to 10000 in ClientConfig

How to reproduce

  1. Create context as defined above
  2. set following in config client_config.set("statistics.interval.ms", "10000");
  3. Create base consumer with context
 let context = CustomContext;
 let base_consumer = BaseConsumer::from_config_and_context(config, context)?;
  1. Once consumer is created, I just loop
loop {
  //sleep 1 sec
}
  1. I expect logs to be printed with via stats method every 10 secs

Checklist

  • rdkafka version : v0.36.2
  • Apache Kafka version: Bitnami Kafka Docker image
               "OS_ARCH=amd64",
               "OS_FLAVOUR=debian-12",
               "OS_NAME=linux",
               "APP_VERSION=3.7.0",
               "BITNAMI_APP_NAME=kafka",
  • client configuration: statistics.interval.ms=10000
  • Host Operating system: Ubuntu
@Guyzeroth
Copy link

Hello, did you subscribe the consumer to a topic first? Try that and then call poll().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants