Loading src/telemetry_frontend/backend/service/KafkaProducerService.py +7 −13 Original line number Diff line number Diff line Loading @@ -19,25 +19,19 @@ class KafkaProducerService: Class to control Kafka producer functionality. """ def __init__(self): pass kafka_configs = self.generate_kafka_configs() self.bootstrap_servers = kafka_configs['bootstrap_servers'] self.node_exporter_endpoint = kafka_configs['node_exporter_endpoint'] self.kafka_topic = kafka_configs['kafka_topic'] self.run_duration = kafka_configs['run_duration'] self.fetch_interval = kafka_configs['fetch_interval'] def generate_kafka_configs(self): # define the function to get every attribute def generate_kafka_configs(self): """ Method to generate Kafka configurations """ create_kafka_configs = { 'bootstrap_servers' : '127.0.0.1:9092', # Kafka broker address - Replace with your Kafka broker address 'node_exporter_endpoint' : 'http://10.152.183.231:9100/metrics', # Node Exporter metrics endpoint - Replace with your Node Exporter endpoint 'kafka_topic' : 'metric-data', # Kafka topic to produce to 'run_duration' : 20, # Total duration to execute the producer 'fetch_interval' : 4 # Time between two fetch requests 'bootstrap_servers' : "test_server", # Kafka broker address - Replace with your Kafka broker address 'exporter_endpoint' : "test_exporter", # Node Exporter metrics endpoint - Replace with your Node Exporter endpoint 'kafka_topic' : "test_kafka_topic", # Kafka topic to produce to 'run_duration' : 10, # Total duration to execute the producer 'fetch_interval' : 2 # Time between two fetch requests } return create_kafka_configs Loading Loading
src/telemetry_frontend/backend/service/KafkaProducerService.py +7 −13 Original line number Diff line number Diff line Loading @@ -19,25 +19,19 @@ class KafkaProducerService: Class to control Kafka producer functionality. """ def __init__(self): pass kafka_configs = self.generate_kafka_configs() self.bootstrap_servers = kafka_configs['bootstrap_servers'] self.node_exporter_endpoint = kafka_configs['node_exporter_endpoint'] self.kafka_topic = kafka_configs['kafka_topic'] self.run_duration = kafka_configs['run_duration'] self.fetch_interval = kafka_configs['fetch_interval'] def generate_kafka_configs(self): # define the function to get every attribute def generate_kafka_configs(self): """ Method to generate Kafka configurations """ create_kafka_configs = { 'bootstrap_servers' : '127.0.0.1:9092', # Kafka broker address - Replace with your Kafka broker address 'node_exporter_endpoint' : 'http://10.152.183.231:9100/metrics', # Node Exporter metrics endpoint - Replace with your Node Exporter endpoint 'kafka_topic' : 'metric-data', # Kafka topic to produce to 'run_duration' : 20, # Total duration to execute the producer 'fetch_interval' : 4 # Time between two fetch requests 'bootstrap_servers' : "test_server", # Kafka broker address - Replace with your Kafka broker address 'exporter_endpoint' : "test_exporter", # Node Exporter metrics endpoint - Replace with your Node Exporter endpoint 'kafka_topic' : "test_kafka_topic", # Kafka topic to produce to 'run_duration' : 10, # Total duration to execute the producer 'fetch_interval' : 2 # Time between two fetch requests } return create_kafka_configs Loading