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
9438223
commit ebcedf1
Showing
15 changed files
with
148 additions
and
21 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 |
---|---|---|
|
@@ -68,4 +68,4 @@ profile_default/ | |
ipython_config.py | ||
|
||
hubspot_credentials.json | ||
test-pipeline.yml | ||
test-pipeline*.yml |
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
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
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,38 @@ | ||
from datadog import initialize, statsd | ||
|
||
from bizon.common.models import BizonConfig | ||
from bizon.engine.pipeline.models import PipelineReturnStatus | ||
|
||
|
||
class Monitor: | ||
def __init__(self, pipeline_config: BizonConfig): | ||
self.pipeline_config = pipeline_config | ||
|
||
# In Kubernetes, set the host dynamically | ||
initialize( | ||
statsd_host=pipeline_config.monitoring.datadog_agent_host, | ||
statsd_port=pipeline_config.monitoring.datadog_agent_port, | ||
) | ||
|
||
self.pipeline_monitor_status = "bizon_pipeline.status" | ||
self.tags = [ | ||
f"name:{self.pipeline_config.name}", | ||
f"stream:{self.pipeline_config.source.stream}", | ||
f"source:{self.pipeline_config.source.name}", | ||
f"destination:{self.pipeline_config.destination.name}", | ||
] | ||
|
||
self.pipeline_active_pipelines = "bizon_pipeline.active_pipelines" | ||
|
||
def report_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'). | ||
""" | ||
|
||
statsd.increment( | ||
self.pipeline_monitor_status, | ||
tags=self.tags + [f"status:{pipeline_status}"], | ||
) |
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 pydantic import BaseModel | ||
|
||
|
||
class MonitoringConfig(BaseModel): | ||
datadog_agent_host: str | ||
datadog_agent_port: int = 8125 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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