mirror of
https://github.com/pavel-odintsov/fastnetmon
synced 2024-09-27 02:25:43 +02:00
Fenced Kafka logic when we have no Kafka compilation enabled
This commit is contained in:
parent
3b3d8419f6
commit
d0e6987519
@ -2602,12 +2602,11 @@ void zeroify_all_flow_counters() {
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef KAFKA
|
||||
// Exports traffic to Kafka
|
||||
void export_to_kafka(const simple_packet_t& current_packet) {
|
||||
extern std::string kafka_traffic_export_topic;
|
||||
#ifdef KAFKA
|
||||
extern cppkafka::Producer* kafka_traffic_export_producer;
|
||||
#endif
|
||||
|
||||
nlohmann::json json_packet;
|
||||
|
||||
@ -2634,6 +2633,7 @@ void export_to_kafka(const simple_packet_t& current_packet) {
|
||||
// logger << log4cpp::Priority::ERROR << "Kafka flush failed";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Process IPv6 traffic
|
||||
void process_ipv6_packet(simple_packet_t& current_packet) {
|
||||
@ -2647,9 +2647,11 @@ void process_ipv6_packet(simple_packet_t& current_packet) {
|
||||
current_packet.packet_direction =
|
||||
get_packet_direction_ipv6(lookup_tree_ipv6, current_packet.src_ipv6, current_packet.dst_ipv6, ipv6_cidr_subnet);
|
||||
|
||||
#ifdef KAFKA
|
||||
if (kafka_traffic_export) {
|
||||
export_to_kafka(current_packet);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef USE_NEW_ATOMIC_BUILTINS
|
||||
__atomic_add_fetch(&total_counters_ipv6.total_counters[current_packet.packet_direction].packets, sampled_number_of_packets, __ATOMIC_RELAXED);
|
||||
@ -2763,9 +2765,11 @@ void process_packet(simple_packet_t& current_packet) {
|
||||
current_packet.packet_direction =
|
||||
get_packet_direction(lookup_tree_ipv4, current_packet.src_ip, current_packet.dst_ip, current_subnet);
|
||||
|
||||
#ifdef KAFKA
|
||||
if (kafka_traffic_export) {
|
||||
export_to_kafka(current_packet);
|
||||
}
|
||||
#endif
|
||||
|
||||
// It's useful in case when we can't find what packets do not processed correctly
|
||||
if (DEBUG_DUMP_OTHER_PACKETS && current_packet.packet_direction == OTHER) {
|
||||
|
Loading…
Reference in New Issue
Block a user