-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Map out structure * Combine classes * Remove deprecated call * Remove clazz * Create structure for kafka client classes * Undo * Fix style * Add consumer offset and log collection (#13944) * Refactor broker offset metric collection (#13934) * Add broker offset metric collection * Change import * Clean up broker offset functions and change names * Fix style * Use updated values for check * Clean up functions * Refactor client creation (#13946) * Refactor client creation * Add back e2e test * Remove commented out line * Remove KafkaClient and refactor tests (#13954) * Revert "Remove KafkaClient and refactor tests (#13954)" This reverts commit e327d71. --------- Co-authored-by: Fanny Jiang <fanny.jiang@datadoghq.com>
- Loading branch information
1 parent
b402854
commit bdd2bdc
Showing
5 changed files
with
584 additions
and
441 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
kafka_consumer/datadog_checks/kafka_consumer/client/confluent_kafka_client.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# (C) Datadog, Inc. 2023-present | ||
# All rights reserved | ||
# Licensed under Simplified BSD License (see LICENSE) | ||
class ConfluentKafkaClient: | ||
def __init__(self) -> None: | ||
pass | ||
|
||
def get_consumer_offsets(self): | ||
pass | ||
|
||
def get_broker_offset(self): | ||
pass | ||
|
||
def report_consumer_offset_and_lag(self): | ||
pass | ||
|
||
def report_broker_offset(self): | ||
pass | ||
|
||
def collect_broker_metadata(self): | ||
pass |
37 changes: 37 additions & 0 deletions
37
kafka_consumer/datadog_checks/kafka_consumer/client/kafka_client.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# (C) Datadog, Inc. 2023-present | ||
# All rights reserved | ||
# Licensed under Simplified BSD License (see LICENSE) | ||
from abc import ABC, abstractmethod | ||
|
||
|
||
class KafkaClient(ABC): | ||
def __init__(self, check) -> None: | ||
self.check = check | ||
self.log = check.log | ||
self._kafka_client = None | ||
self._highwater_offsets = {} | ||
self._consumer_offsets = {} | ||
self._context_limit = check._context_limit | ||
|
||
def should_get_highwater_offsets(self): | ||
return len(self._consumer_offsets) < self._context_limit | ||
|
||
@abstractmethod | ||
def get_consumer_offsets(self): | ||
pass | ||
|
||
@abstractmethod | ||
def get_highwater_offsets(self): | ||
pass | ||
|
||
@abstractmethod | ||
def report_consumer_offsets_and_lag(self): | ||
pass | ||
|
||
@abstractmethod | ||
def report_highwater_offsets(self): | ||
pass | ||
|
||
@abstractmethod | ||
def collect_broker_metadata(self): | ||
pass |
6 changes: 6 additions & 0 deletions
6
kafka_consumer/datadog_checks/kafka_consumer/client/kafka_client_factory.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from datadog_checks.kafka_consumer.client.kafka_client import KafkaClient | ||
from datadog_checks.kafka_consumer.client.kafka_python_client import KafkaPythonClient | ||
|
||
|
||
def make_client(check) -> KafkaClient: | ||
return KafkaPythonClient(check) |
Oops, something went wrong.