forked from bizon-data/bizon-core
-
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.
- Loading branch information
1 parent
8a6198e
commit 0001f85
Showing
11 changed files
with
87 additions
and
27 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
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
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,6 +1,18 @@ | ||
from enum import Enum | ||
from typing import Optional | ||
|
||
from pydantic import BaseModel | ||
|
||
|
||
class MonitoringConfig(BaseModel): | ||
class MonitorType(str, Enum): | ||
DATADOG = "datadog" | ||
|
||
|
||
class DatadogConfig(BaseModel): | ||
datadog_agent_host: str | ||
datadog_agent_port: int = 8125 | ||
|
||
|
||
class MonitoringConfig(BaseModel): | ||
type: MonitorType | ||
config: Optional[DatadogConfig] = None |
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from abc import ABC, abstractmethod | ||
|
||
from bizon.common.models import BizonConfig | ||
from bizon.engine.pipeline.models import PipelineReturnStatus | ||
from bizon.monitoring.config import MonitorType | ||
|
||
|
||
class AbstractMonitor(ABC): | ||
def __init__(self, pipeline_config: BizonConfig): | ||
self.pipeline_config = pipeline_config | ||
# Initialize the monitor | ||
|
||
@abstractmethod | ||
def track_pipeline_status(self, pipeline_status: PipelineReturnStatus) -> None: | ||
""" | ||
Track the status of the pipeline. | ||
Args: | ||
status (str): The current status of the pipeline (e.g., 'running', 'failed', 'completed'). | ||
""" | ||
pass | ||
|
||
|
||
class MonitorFactory: | ||
@staticmethod | ||
def get_monitor(pipeline_config: BizonConfig) -> AbstractMonitor: | ||
if pipeline_config.monitoring is None: | ||
from bizon.monitoring.noop.monitor import NoOpMonitor | ||
|
||
return NoOpMonitor(pipeline_config) | ||
|
||
if pipeline_config.monitoring.type == MonitorType.DATADOG: | ||
from bizon.monitoring.datadog.monitor import DatadogMonitor | ||
|
||
return DatadogMonitor(pipeline_config) |
Empty file.
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,11 @@ | ||
from bizon.common.models import BizonConfig | ||
from bizon.engine.pipeline.models import PipelineReturnStatus | ||
from bizon.monitoring.monitor import AbstractMonitor | ||
|
||
|
||
class NoOpMonitor(AbstractMonitor): | ||
def __init__(self, pipeline_config: BizonConfig): | ||
super().__init__(pipeline_config) | ||
|
||
def track_pipeline_status(self, pipeline_status: PipelineReturnStatus) -> None: | ||
pass |