-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
9 changed files
with
91 additions
and
58 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
from abc import ABC, abstractmethod | ||
from typing import Union | ||
|
||
from celery.events.state import Task, Worker | ||
|
||
|
||
class Exporter(ABC): | ||
@abstractmethod | ||
def process_event(self, event: Union[Task, Worker]): | ||
def process_event(self, event: Task | Worker): | ||
pass |
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 |
---|---|---|
|
@@ -4,30 +4,51 @@ version = "0.1.0" | |
description = "Celery metrics exporter for Datadog and Postgres" | ||
authors = ["Airbase Inc <[email protected]>"] | ||
|
||
[build-system] | ||
requires = ["poetry-core>=1.2.0"] | ||
build-backend = "poetry.core.masonry.api" | ||
|
||
[tool.poetry.dependencies] | ||
python = "3.10.*" | ||
celery = "^5.2" | ||
datadog = "^0.44" | ||
kombu = "^5.2" | ||
redis = "^4.3" | ||
amqp = "^5.1" | ||
python = "3.12.*" | ||
amqp = "^5.2" | ||
celery = "^5.4" | ||
click = "^8.1" | ||
requests = "^2.28" | ||
daiquiri = "^3.1.0" | ||
datadog = "^0.50" | ||
kombu = "^5.2" | ||
redis = "^5.0" | ||
|
||
[tool.poetry.dev-dependencies] | ||
black = "22.3.0" | ||
flake8 = "4.0.1" | ||
taskipy = "^1.10.2" | ||
pre-commit = "^2.19.0" | ||
[tool.poetry.group.dev.dependencies] | ||
flake8 = "^7.1" | ||
pre-commit = "^3.8" | ||
ruff = "^0.6.4" # Upgrade along with version in .pre-commit-config.yaml | ||
taskipy = "^1.13" | ||
|
||
[build-system] | ||
requires = ["poetry-core>=1.0.0"] | ||
build-backend = "poetry.core.masonry.api" | ||
[tool.ruff] | ||
line-length = 88 | ||
target-version = "py312" | ||
exclude = [] | ||
|
||
[tool.poetry.scripts] | ||
eventbusk = "cli:cli" | ||
[tool.ruff.lint] | ||
select = ["ALL"] | ||
ignore = [ | ||
"ANN001", | ||
"ANN201", | ||
"ANN205", | ||
"D100", | ||
"D101", | ||
"D102", | ||
"D103", | ||
"D104", | ||
"D107", | ||
"D211", | ||
"D213", | ||
"E501", | ||
"G004", | ||
"RUF012", | ||
] | ||
|
||
[tool.taskipy.tasks] | ||
pre_freeze = "echo '# Do not edit directly, but instead via poetry' > requirements.txt && echo '# Do not edit directly, but instead via poetry. Also contains pinned dev requirements.' > requirements_all.txt" | ||
freeze = "poetry export --without-hashes --format=requirements.txt >> requirements.txt && poetry export --dev --without-hashes --format=requirements.txt >> requirements_all.txt" | ||
freeze = "poetry export --without-hashes --format=requirements.txt >> requirements.txt && poetry export --with dev --without-hashes --format=requirements.txt >> requirements_all.txt" | ||
ruff = "ruff check --unsafe-fixes" |
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 @@ | ||
python-3.12.6 |
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,9 +1,10 @@ | ||
def is_event_type_task(event_type: str): | ||
"""Return true when event type is of type event | ||
"""Return true when event type is of type event. | ||
Returns | ||
-------- | ||
------- | ||
bool | ||
returns true when event type is of type event | ||
""" | ||
return event_type and event_type.startswith("task-") |