-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
-- Defined metrics
- Loading branch information
Amit Bhanja
committed
Feb 13, 2024
1 parent
ae4b745
commit 7c4eeec
Showing
5 changed files
with
25 additions
and
55 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,14 +1,25 @@ | ||
import os | ||
import shutil | ||
from prometheus_client import multiprocess, CollectorRegistry | ||
from prometheus_client import Counter, Enum | ||
|
||
NAMESPACE = 'kafka_notify' | ||
path = os.environ.get('PROMETHEUS_MULTIPROC_DIR') | ||
if os.path.exists(path): | ||
shutil.rmtree(path) | ||
os.mkdir(path) | ||
|
||
registry = CollectorRegistry() | ||
multiprocess.MultiProcessCollector(registry) | ||
|
||
PROCESS_STATES = Enum('process_states', 'State of the process', states=['idle', 'processing', | ||
'error - recoverable', 'error - ' | ||
'need restart'] | ||
, namespace=NAMESPACE) | ||
'error - recoverable', 'error - ' | ||
'need restart'] | ||
, namespace='kafka_notify', registry=registry) | ||
|
||
NOTIFICATIONS_SENT = Counter('notifications_sent', 'Number of notifications sent', | ||
['type', 'name', 'endpoint'], namespace=NAMESPACE) | ||
['type', 'name', 'endpoint'], namespace='kafka_notify', | ||
registry=registry) | ||
NOTIFICATIONS_ERROR = Counter('notifications_error', | ||
'Number of notifications that could not be sent due to error', | ||
['type', 'name', 'endpoint', 'exception'], namespace=NAMESPACE) | ||
['type', 'name', 'endpoint', 'exception'], namespace='kafka_notify', | ||
registry=registry) |
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
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
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
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