dagnose 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dagnose-0.1.0/.dockerignore +6 -0
- dagnose-0.1.0/.github/ISSUE_TEMPLATE/bug_report.md +26 -0
- dagnose-0.1.0/.github/ISSUE_TEMPLATE/config.yml +5 -0
- dagnose-0.1.0/.github/ISSUE_TEMPLATE/feature_request.md +14 -0
- dagnose-0.1.0/.github/dependabot.yml +17 -0
- dagnose-0.1.0/.github/pull_request_template.md +14 -0
- dagnose-0.1.0/.github/workflows/ci.yml +131 -0
- dagnose-0.1.0/.github/workflows/release.yml +71 -0
- dagnose-0.1.0/.gitignore +22 -0
- dagnose-0.1.0/CHANGELOG.md +13 -0
- dagnose-0.1.0/CODE_OF_CONDUCT.md +9 -0
- dagnose-0.1.0/CONTRIBUTING.md +120 -0
- dagnose-0.1.0/Dockerfile +31 -0
- dagnose-0.1.0/LICENSE +202 -0
- dagnose-0.1.0/PKG-INFO +310 -0
- dagnose-0.1.0/README.md +272 -0
- dagnose-0.1.0/SECURITY.md +17 -0
- dagnose-0.1.0/deploy/aws/ecs-task-definition.json +48 -0
- dagnose-0.1.0/deploy/kubernetes/dagnose.yaml +81 -0
- dagnose-0.1.0/dev/.env.example +2 -0
- dagnose-0.1.0/dev/airflow2/docker-compose.yml +100 -0
- dagnose-0.1.0/dev/dags/demo/README.md +21 -0
- dagnose-0.1.0/dev/dags/demo/crm_push.py +37 -0
- dagnose-0.1.0/dev/dags/demo/crm_session_sync.py +34 -0
- dagnose-0.1.0/dev/dags/demo/customer_scoring.py +29 -0
- dagnose-0.1.0/dev/dags/demo/daily_revenue.py +33 -0
- dagnose-0.1.0/dev/dags/demo/expected.json +9 -0
- dagnose-0.1.0/dev/dags/demo/orders_tax.py +34 -0
- dagnose-0.1.0/dev/dags/demo/partner_export.py +30 -0
- dagnose-0.1.0/dev/dags/scenarios/scenario_big_log.py +33 -0
- dagnose-0.1.0/dev/dags/scenarios/scenario_killed.py +36 -0
- dagnose-0.1.0/dev/dags/scenarios/scenario_mapped.py +32 -0
- dagnose-0.1.0/dev/dags/scenarios/scenario_retries.py +30 -0
- dagnose-0.1.0/dev/diagnose_fixtures.py +94 -0
- dagnose-0.1.0/dev/docker-compose.yml +117 -0
- dagnose-0.1.0/dev/e2e.py +283 -0
- dagnose-0.1.0/dev/install_hooks.sh +12 -0
- dagnose-0.1.0/dev/plugins/dagnose_plugin.py +4 -0
- dagnose-0.1.0/dev/record_fixtures.py +96 -0
- dagnose-0.1.0/dev/scan_secrets.py +64 -0
- dagnose-0.1.0/dev/trigger.py +49 -0
- dagnose-0.1.0/docs/deploy-cloud.md +78 -0
- dagnose-0.1.0/docs/install.md +287 -0
- dagnose-0.1.0/docs/testing.md +134 -0
- dagnose-0.1.0/pyproject.toml +104 -0
- dagnose-0.1.0/src/dagnose/__init__.py +8 -0
- dagnose-0.1.0/src/dagnose/agent/__init__.py +38 -0
- dagnose-0.1.0/src/dagnose/agent/anthropic_provider.py +203 -0
- dagnose-0.1.0/src/dagnose/agent/clients.py +82 -0
- dagnose-0.1.0/src/dagnose/agent/diagnose.py +192 -0
- dagnose-0.1.0/src/dagnose/agent/prompt.py +189 -0
- dagnose-0.1.0/src/dagnose/agent/provider.py +80 -0
- dagnose-0.1.0/src/dagnose/agent/tools.py +142 -0
- dagnose-0.1.0/src/dagnose/check.py +355 -0
- dagnose-0.1.0/src/dagnose/cli.py +454 -0
- dagnose-0.1.0/src/dagnose/collector/__init__.py +6 -0
- dagnose-0.1.0/src/dagnose/collector/airflow_api.py +256 -0
- dagnose-0.1.0/src/dagnose/collector/cloud.py +199 -0
- dagnose-0.1.0/src/dagnose/collector/collect.py +116 -0
- dagnose-0.1.0/src/dagnose/collector/git.py +55 -0
- dagnose-0.1.0/src/dagnose/collector/logs.py +203 -0
- dagnose-0.1.0/src/dagnose/config.py +130 -0
- dagnose-0.1.0/src/dagnose/health.py +53 -0
- dagnose-0.1.0/src/dagnose/incidents.py +172 -0
- dagnose-0.1.0/src/dagnose/models.py +212 -0
- dagnose-0.1.0/src/dagnose/notifier/__init__.py +169 -0
- dagnose-0.1.0/src/dagnose/notifier/card.py +222 -0
- dagnose-0.1.0/src/dagnose/notifier/chat.py +132 -0
- dagnose-0.1.0/src/dagnose/notifier/mail.py +126 -0
- dagnose-0.1.0/src/dagnose/notifier/slack.py +144 -0
- dagnose-0.1.0/src/dagnose/plugin/__init__.py +14 -0
- dagnose-0.1.0/src/dagnose/plugin/listener.py +39 -0
- dagnose-0.1.0/src/dagnose/py.typed +0 -0
- dagnose-0.1.0/src/dagnose/queue.py +243 -0
- dagnose-0.1.0/src/dagnose/redactor/__init__.py +5 -0
- dagnose-0.1.0/src/dagnose/redactor/detectors.py +122 -0
- dagnose-0.1.0/src/dagnose/redactor/redact.py +285 -0
- dagnose-0.1.0/src/dagnose/review.py +244 -0
- dagnose-0.1.0/src/dagnose/watcher.py +64 -0
- dagnose-0.1.0/src/dagnose/worker.py +229 -0
- dagnose-0.1.0/tests/__init__.py +0 -0
- dagnose-0.1.0/tests/conftest.py +63 -0
- dagnose-0.1.0/tests/fixtures/api/v1/demo_crm_push.json +84 -0
- dagnose-0.1.0/tests/fixtures/api/v1/demo_crm_session_sync.json +84 -0
- dagnose-0.1.0/tests/fixtures/api/v1/demo_customer_scoring.json +84 -0
- dagnose-0.1.0/tests/fixtures/api/v1/demo_daily_revenue.json +84 -0
- dagnose-0.1.0/tests/fixtures/api/v1/demo_orders_tax.json +84 -0
- dagnose-0.1.0/tests/fixtures/api/v1/demo_partner_export.json +84 -0
- dagnose-0.1.0/tests/fixtures/api/v2/demo_crm_push.json +76 -0
- dagnose-0.1.0/tests/fixtures/api/v2/demo_crm_session_sync.json +76 -0
- dagnose-0.1.0/tests/fixtures/api/v2/demo_customer_scoring.json +76 -0
- dagnose-0.1.0/tests/fixtures/api/v2/demo_daily_revenue.json +76 -0
- dagnose-0.1.0/tests/fixtures/api/v2/demo_orders_tax.json +76 -0
- dagnose-0.1.0/tests/fixtures/api/v2/demo_partner_export.json +76 -0
- dagnose-0.1.0/tests/fixtures/contexts/v1/demo_crm_push.json +1031 -0
- dagnose-0.1.0/tests/fixtures/contexts/v1/demo_crm_session_sync.json +961 -0
- dagnose-0.1.0/tests/fixtures/contexts/v1/demo_customer_scoring.json +937 -0
- dagnose-0.1.0/tests/fixtures/contexts/v1/demo_daily_revenue.json +951 -0
- dagnose-0.1.0/tests/fixtures/contexts/v1/demo_orders_tax.json +957 -0
- dagnose-0.1.0/tests/fixtures/contexts/v1/demo_partner_export.json +488 -0
- dagnose-0.1.0/tests/fixtures/contexts/v2/demo_crm_push.json +167 -0
- dagnose-0.1.0/tests/fixtures/contexts/v2/demo_crm_session_sync.json +181 -0
- dagnose-0.1.0/tests/fixtures/contexts/v2/demo_customer_scoring.json +157 -0
- dagnose-0.1.0/tests/fixtures/contexts/v2/demo_daily_revenue.json +157 -0
- dagnose-0.1.0/tests/fixtures/contexts/v2/demo_orders_tax.json +163 -0
- dagnose-0.1.0/tests/fixtures/contexts/v2/demo_partner_export.json +197 -0
- dagnose-0.1.0/tests/test_agent.py +367 -0
- dagnose-0.1.0/tests/test_anthropic_provider.py +182 -0
- dagnose-0.1.0/tests/test_chat_cards.py +109 -0
- dagnose-0.1.0/tests/test_check.py +244 -0
- dagnose-0.1.0/tests/test_cli.py +87 -0
- dagnose-0.1.0/tests/test_cloud.py +331 -0
- dagnose-0.1.0/tests/test_collect_replay.py +156 -0
- dagnose-0.1.0/tests/test_incidents.py +214 -0
- dagnose-0.1.0/tests/test_listener_and_api.py +152 -0
- dagnose-0.1.0/tests/test_llm_platforms.py +144 -0
- dagnose-0.1.0/tests/test_logs.py +116 -0
- dagnose-0.1.0/tests/test_notifier.py +425 -0
- dagnose-0.1.0/tests/test_queue.py +147 -0
- dagnose-0.1.0/tests/test_redactor.py +311 -0
- dagnose-0.1.0/tests/test_review.py +174 -0
- dagnose-0.1.0/tests/test_watcher.py +176 -0
- dagnose-0.1.0/tests/test_worker.py +183 -0
- dagnose-0.1.0/uv.lock +2205 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug report
|
|
3
|
+
about: Something in Dagnose does not work as documented
|
|
4
|
+
labels: bug
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**Do not paste logs, cards or diagnosis files without checking them for secrets and
|
|
8
|
+
company data first.** Security problems go to the private channel in SECURITY.md, not
|
|
9
|
+
here.
|
|
10
|
+
|
|
11
|
+
## What happened
|
|
12
|
+
|
|
13
|
+
<!-- What you did, what you expected, what happened instead. -->
|
|
14
|
+
|
|
15
|
+
## Output of `dagnose check`
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
<!-- Paste it here. It contains no secrets. -->
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Environment
|
|
22
|
+
|
|
23
|
+
- Dagnose version (`dagnose version`):
|
|
24
|
+
- Airflow version and how it runs (Docker Compose, Kubernetes, MWAA, Composer, ...):
|
|
25
|
+
- How failures are found (`DAGNOSE_WATCH`):
|
|
26
|
+
- Model provider (Claude API, Bedrock, Vertex AI, Foundry):
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature request
|
|
3
|
+
about: Suggest an improvement
|
|
4
|
+
labels: enhancement
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## The problem
|
|
8
|
+
|
|
9
|
+
<!-- What is hard or impossible today? A real failure you could not diagnose is the
|
|
10
|
+
best example (described in words, without logs or secrets). -->
|
|
11
|
+
|
|
12
|
+
## What you would like
|
|
13
|
+
|
|
14
|
+
## Alternatives you considered
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
updates:
|
|
3
|
+
- package-ecosystem: github-actions
|
|
4
|
+
directory: /
|
|
5
|
+
schedule:
|
|
6
|
+
interval: weekly
|
|
7
|
+
groups:
|
|
8
|
+
actions:
|
|
9
|
+
patterns: ["*"]
|
|
10
|
+
|
|
11
|
+
- package-ecosystem: uv
|
|
12
|
+
directory: /
|
|
13
|
+
schedule:
|
|
14
|
+
interval: weekly
|
|
15
|
+
groups:
|
|
16
|
+
python:
|
|
17
|
+
patterns: ["*"]
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
## What and why
|
|
2
|
+
|
|
3
|
+
<!-- What this changes and the problem it solves. -->
|
|
4
|
+
|
|
5
|
+
## How it was tested
|
|
6
|
+
|
|
7
|
+
<!-- Tests added or changed; for behaviour changes, how you checked it on a real or
|
|
8
|
+
dev Airflow (see docs/testing.md). -->
|
|
9
|
+
|
|
10
|
+
## Checklist
|
|
11
|
+
|
|
12
|
+
- [ ] `uv run ruff check . && uv run ruff format --check . && uv run mypy && uv run pytest` pass
|
|
13
|
+
- [ ] No logs, secrets or company data in the code, tests or fixtures
|
|
14
|
+
- [ ] Docs and CHANGELOG updated if users will notice the change
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
name: ci
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
workflow_call: # reused by release.yml so a release runs every check first
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
concurrency:
|
|
13
|
+
group: ci-${{ github.workflow }}-${{ github.ref }}
|
|
14
|
+
cancel-in-progress: true
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
lint:
|
|
18
|
+
name: lint + types
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
timeout-minutes: 10
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v7
|
|
23
|
+
- uses: astral-sh/setup-uv@v7
|
|
24
|
+
with:
|
|
25
|
+
python-version: "3.12"
|
|
26
|
+
- run: uv sync --locked
|
|
27
|
+
- name: No secrets in the repo
|
|
28
|
+
run: uv run python dev/scan_secrets.py
|
|
29
|
+
- run: uv run ruff check .
|
|
30
|
+
- run: uv run ruff format --check .
|
|
31
|
+
- run: uv run mypy
|
|
32
|
+
|
|
33
|
+
test:
|
|
34
|
+
name: tests (py${{ matrix.python-version }})
|
|
35
|
+
runs-on: ubuntu-latest
|
|
36
|
+
timeout-minutes: 10
|
|
37
|
+
strategy:
|
|
38
|
+
fail-fast: false
|
|
39
|
+
matrix:
|
|
40
|
+
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
|
41
|
+
steps:
|
|
42
|
+
- uses: actions/checkout@v7
|
|
43
|
+
- uses: astral-sh/setup-uv@v7
|
|
44
|
+
with:
|
|
45
|
+
python-version: ${{ matrix.python-version }}
|
|
46
|
+
- run: uv sync --locked
|
|
47
|
+
- run: uv run pytest --cov --cov-report=term-missing --cov-report=xml
|
|
48
|
+
- if: matrix.python-version == '3.12'
|
|
49
|
+
uses: actions/upload-artifact@v7
|
|
50
|
+
with:
|
|
51
|
+
name: coverage
|
|
52
|
+
path: coverage.xml
|
|
53
|
+
|
|
54
|
+
e2e:
|
|
55
|
+
name: e2e (Airflow ${{ matrix.airflow }})
|
|
56
|
+
needs: test
|
|
57
|
+
runs-on: ubuntu-latest
|
|
58
|
+
timeout-minutes: 25
|
|
59
|
+
strategy:
|
|
60
|
+
fail-fast: false
|
|
61
|
+
matrix:
|
|
62
|
+
include:
|
|
63
|
+
- airflow: "3"
|
|
64
|
+
compose-dir: dev
|
|
65
|
+
home: dev/dagnose-data
|
|
66
|
+
- airflow: "2"
|
|
67
|
+
compose-dir: dev/airflow2
|
|
68
|
+
home: dev/airflow2/dagnose-data
|
|
69
|
+
steps:
|
|
70
|
+
- uses: actions/checkout@v7
|
|
71
|
+
- uses: astral-sh/setup-uv@v7
|
|
72
|
+
with:
|
|
73
|
+
python-version: "3.12"
|
|
74
|
+
- run: uv sync --locked
|
|
75
|
+
# Containers write the spool as the runner user, so the worker on the host can
|
|
76
|
+
# read and delete the files.
|
|
77
|
+
- run: echo "AIRFLOW_UID=$(id -u)" >> "$GITHUB_ENV"
|
|
78
|
+
- name: Start Airflow ${{ matrix.airflow }}
|
|
79
|
+
working-directory: ${{ matrix.compose-dir }}
|
|
80
|
+
run: docker compose up -d
|
|
81
|
+
- name: Fail the demo DAGs, then check listener -> worker -> collector
|
|
82
|
+
run: uv run python dev/e2e.py --airflow ${{ matrix.airflow }} --timeout 900
|
|
83
|
+
- name: Same with API polling only (no plugin, no shared folder)
|
|
84
|
+
run: uv run python dev/e2e.py --airflow ${{ matrix.airflow }} --timeout 900 --watch api
|
|
85
|
+
- name: Airflow logs
|
|
86
|
+
if: failure()
|
|
87
|
+
working-directory: ${{ matrix.compose-dir }}
|
|
88
|
+
run: docker compose ps -a && docker compose logs --tail 200
|
|
89
|
+
- if: failure()
|
|
90
|
+
uses: actions/upload-artifact@v7
|
|
91
|
+
with:
|
|
92
|
+
name: e2e-airflow${{ matrix.airflow }}
|
|
93
|
+
path: |
|
|
94
|
+
${{ matrix.home }}
|
|
95
|
+
${{ matrix.compose-dir }}/logs
|
|
96
|
+
if-no-files-found: ignore
|
|
97
|
+
- name: Stop Airflow
|
|
98
|
+
if: always()
|
|
99
|
+
working-directory: ${{ matrix.compose-dir }}
|
|
100
|
+
run: docker compose down -v
|
|
101
|
+
|
|
102
|
+
build:
|
|
103
|
+
name: build package
|
|
104
|
+
runs-on: ubuntu-latest
|
|
105
|
+
timeout-minutes: 10
|
|
106
|
+
steps:
|
|
107
|
+
- uses: actions/checkout@v7
|
|
108
|
+
- uses: astral-sh/setup-uv@v7
|
|
109
|
+
with:
|
|
110
|
+
python-version: "3.12"
|
|
111
|
+
- run: uv build
|
|
112
|
+
- name: Install the wheel in a clean venv and smoke test it
|
|
113
|
+
run: |
|
|
114
|
+
uv venv /tmp/clean
|
|
115
|
+
uv pip install --python /tmp/clean dist/*.whl
|
|
116
|
+
expected=$(uv run --no-project python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])")
|
|
117
|
+
installed=$(/tmp/clean/bin/dagnose version)
|
|
118
|
+
echo "pyproject: $expected installed: $installed"
|
|
119
|
+
test "$expected" = "$installed"
|
|
120
|
+
/tmp/clean/bin/python -c "from importlib.metadata import entry_points; eps = entry_points(group='airflow.plugins'); assert any(ep.name == 'dagnose' for ep in eps), 'Airflow plugin entry point missing'"
|
|
121
|
+
- uses: actions/upload-artifact@v7
|
|
122
|
+
with:
|
|
123
|
+
name: dist
|
|
124
|
+
path: dist/
|
|
125
|
+
- name: Build the worker image and smoke test it
|
|
126
|
+
run: |
|
|
127
|
+
docker build -t dagnose:ci .
|
|
128
|
+
expected=$(uv run --no-project python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])")
|
|
129
|
+
test "$(docker run --rm dagnose:ci version)" = "$expected"
|
|
130
|
+
test "$(docker run --rm --entrypoint id dagnose:ci -un)" = "dagnose"
|
|
131
|
+
docker run --rm dagnose:ci --help > /dev/null
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
name: release
|
|
2
|
+
|
|
3
|
+
# Push a tag like v0.1.0 (matching [project].version in pyproject.toml) to release:
|
|
4
|
+
# the package goes to PyPI and the worker image to ghcr.io/<owner>/dagnose.
|
|
5
|
+
# One-time setup: add this repository as a "trusted publisher" on PyPI
|
|
6
|
+
# (project dagnose, workflow release.yml, environment pypi). No token needed.
|
|
7
|
+
|
|
8
|
+
on:
|
|
9
|
+
push:
|
|
10
|
+
tags: ["v*"]
|
|
11
|
+
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
ci:
|
|
17
|
+
uses: ./.github/workflows/ci.yml
|
|
18
|
+
|
|
19
|
+
publish:
|
|
20
|
+
needs: ci
|
|
21
|
+
runs-on: ubuntu-latest
|
|
22
|
+
timeout-minutes: 10
|
|
23
|
+
environment: pypi
|
|
24
|
+
permissions:
|
|
25
|
+
id-token: write # PyPI trusted publishing (OIDC)
|
|
26
|
+
contents: write # create the GitHub release
|
|
27
|
+
steps:
|
|
28
|
+
- uses: actions/checkout@v7
|
|
29
|
+
- uses: astral-sh/setup-uv@v7
|
|
30
|
+
with:
|
|
31
|
+
python-version: "3.12"
|
|
32
|
+
- name: Tag must match the package version
|
|
33
|
+
run: |
|
|
34
|
+
version=$(uv run --no-project python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])")
|
|
35
|
+
if [ "v$version" != "$GITHUB_REF_NAME" ]; then
|
|
36
|
+
echo "Tag $GITHUB_REF_NAME does not match pyproject version $version"
|
|
37
|
+
exit 1
|
|
38
|
+
fi
|
|
39
|
+
- run: uv build
|
|
40
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
41
|
+
- name: GitHub release
|
|
42
|
+
env:
|
|
43
|
+
GH_TOKEN: ${{ github.token }}
|
|
44
|
+
run: gh release create "$GITHUB_REF_NAME" dist/* --title "$GITHUB_REF_NAME" --generate-notes
|
|
45
|
+
|
|
46
|
+
image:
|
|
47
|
+
needs: publish
|
|
48
|
+
runs-on: ubuntu-latest
|
|
49
|
+
timeout-minutes: 30
|
|
50
|
+
permissions:
|
|
51
|
+
contents: read
|
|
52
|
+
packages: write # push to ghcr.io with the workflow's own token
|
|
53
|
+
steps:
|
|
54
|
+
- uses: actions/checkout@v7
|
|
55
|
+
- uses: docker/setup-qemu-action@v3
|
|
56
|
+
- uses: docker/setup-buildx-action@v3
|
|
57
|
+
- uses: docker/login-action@v3
|
|
58
|
+
with:
|
|
59
|
+
registry: ghcr.io
|
|
60
|
+
username: ${{ github.actor }}
|
|
61
|
+
password: ${{ github.token }}
|
|
62
|
+
- name: Image name (ghcr needs lower case)
|
|
63
|
+
run: echo "IMAGE=ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/dagnose" >> "$GITHUB_ENV"
|
|
64
|
+
- uses: docker/build-push-action@v6
|
|
65
|
+
with:
|
|
66
|
+
context: .
|
|
67
|
+
platforms: linux/amd64,linux/arm64 # Intel and ARM (Apple Silicon, Graviton)
|
|
68
|
+
push: true
|
|
69
|
+
tags: |
|
|
70
|
+
${{ env.IMAGE }}:${{ github.ref_name }}
|
|
71
|
+
${{ env.IMAGE }}:latest
|
dagnose-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
__pycache__/
|
|
2
|
+
*.py[cod]
|
|
3
|
+
.venv/
|
|
4
|
+
dist/
|
|
5
|
+
build/
|
|
6
|
+
*.egg-info/
|
|
7
|
+
.pytest_cache/
|
|
8
|
+
.mypy_cache/
|
|
9
|
+
.ruff_cache/
|
|
10
|
+
.env
|
|
11
|
+
# local Airflow runtime
|
|
12
|
+
dev/logs/
|
|
13
|
+
dev/config/
|
|
14
|
+
*.db
|
|
15
|
+
dev/dagnose-data/
|
|
16
|
+
dev/airflow2/logs/
|
|
17
|
+
dev/airflow2/dagnose-data/
|
|
18
|
+
.coverage
|
|
19
|
+
coverage.xml
|
|
20
|
+
|
|
21
|
+
# macOS
|
|
22
|
+
.DS_Store
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.0 (2026-11-25)
|
|
4
|
+
|
|
5
|
+
First release.
|
|
6
|
+
|
|
7
|
+
- **Finds failed tasks** by polling the Airflow REST API every 15 seconds (no plugin, no shared folder; works with Kubernetes and Celery workers) and, optionally, instantly through an Airflow listener plugin. Airflow 2.x (REST API v1) and 3.x (v2), tested on 2.11 and 3.3.
|
|
8
|
+
- **Collects** the exception and failing line, task log, DAG source, task inputs, run history and recent git commits to the DAG file. Detects when Airflow itself cannot serve a task log and says why.
|
|
9
|
+
- **Redacts** secrets before anything leaves the process: passwords in connection strings, `password=` / `token=` / `api_key=` values, known token formats, emails, high-entropy keys, sensitive task params and git author names. Same secret, same placeholder; one-way. Flags such as MySQL's `(using password: YES)` are kept.
|
|
10
|
+
- **Diagnoses** with Claude (Opus 5.5 by default) through a provider interface: summary, category, root cause, evidence quotes checked against the logs and code, confidence (capped when the evidence does not check out), suggested fix and an optional patch. About USD 0.04 to 0.06 per diagnosis.
|
|
11
|
+
- **Notifies** through Slack (incoming webhook) and email (SMTP), redacted again before sending; undeliverable messages go to an outbox. Cards put what to do first, then why it failed and the evidence; confidence is in words (High, Medium, Low); plain text, no emoji. Cards for mapped tasks name the map index. Webhook URLs never appear in the logs.
|
|
12
|
+
- **Repeats and cost**: failures are fingerprinted; the same failure within 24 h reuses its diagnosis (no model call) and gets a "still failing (N times)" card at most hourly; at most 20 diagnoses per hour.
|
|
13
|
+
- **`dagnose check`** verifies the whole setup, with a fix for each problem, and warns when the Airflow user can do more than read; **`dagnose worker`** runs the pipeline; **`dagnose queue`** shows job counts and the most recent jobs (`--dag`, `--last`). **`dagnose review`** grades diagnoses, confirms each grade before saving, and `--redo DAG_ID` grades one again. Docker image for Intel and ARM.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Code of conduct
|
|
2
|
+
|
|
3
|
+
This project follows the [Contributor Covenant, version 2.1](https://www.contributor-covenant.org/version/2/1/code_of_conduct/).
|
|
4
|
+
|
|
5
|
+
In short: be respectful and constructive, assume good intent, and keep discussions
|
|
6
|
+
about the work. Harassment of any kind is not accepted.
|
|
7
|
+
|
|
8
|
+
Report unacceptable behaviour privately to the maintainer (GitHub user `naresy`).
|
|
9
|
+
Reports are handled confidentially.
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# Contributing to Dagnose
|
|
2
|
+
|
|
3
|
+
Thank you for helping. This guide covers the development setup, the tests, and how a
|
|
4
|
+
change gets merged.
|
|
5
|
+
|
|
6
|
+
Everyone taking part follows the [code of conduct](CODE_OF_CONDUCT.md).
|
|
7
|
+
|
|
8
|
+
## Development setup
|
|
9
|
+
|
|
10
|
+
Requirements: Python 3.10 or newer, [uv](https://docs.astral.sh/uv/), Docker with at
|
|
11
|
+
least 4 GB of memory, and git.
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
git clone https://github.com/naresy/dagnose.git
|
|
15
|
+
cd dagnose
|
|
16
|
+
uv sync # installs the package and the development tools
|
|
17
|
+
./dev/install_hooks.sh # pre-commit hook that blocks commits containing keys
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Run the checks that CI runs:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
uv run ruff check .
|
|
24
|
+
uv run ruff format --check .
|
|
25
|
+
uv run mypy
|
|
26
|
+
uv run pytest
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
The unit tests replay recorded Airflow API traffic (`tests/fixtures/api/`), so they need
|
|
30
|
+
no running Airflow and no API key. Tests never call a real model.
|
|
31
|
+
|
|
32
|
+
## Local Airflow for development
|
|
33
|
+
|
|
34
|
+
Two Airflow versions run side by side with the same demo DAGs and the listener plugin
|
|
35
|
+
loaded from `src/`:
|
|
36
|
+
|
|
37
|
+
| Airflow | Start | UI and API | Login |
|
|
38
|
+
|---|---|---|---|
|
|
39
|
+
| 3.3 | `cd dev && docker compose up -d` | http://localhost:8080 | airflow / airflow |
|
|
40
|
+
| 2.11 | `cd dev/airflow2 && docker compose up -d` | http://localhost:8081 | airflow / airflow |
|
|
41
|
+
|
|
42
|
+
`dev/dags/demo/` holds DAGs that fail on purpose, and `dev/dags/scenarios/` holds edge cases
|
|
43
|
+
(retries, a mapped task, a very long log, a killed task) used by the [testing plan](docs/testing.md). They are written like ordinary
|
|
44
|
+
pipelines, so their names and comments do not give the cause away; what each one does
|
|
45
|
+
wrong is in [dev/dags/demo/README.md](dev/dags/demo/README.md). One of them leaks fake
|
|
46
|
+
credentials to test redaction. What each DAG must produce is in
|
|
47
|
+
`dev/dags/demo/expected.json`, shared by the unit tests and the end-to-end check.
|
|
48
|
+
|
|
49
|
+
Run the worker against the local Airflow 3:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
export DAGNOSE_HOME=dev/dagnose-data
|
|
53
|
+
export DAGNOSE_AIRFLOW_USERNAME=airflow DAGNOSE_AIRFLOW_PASSWORD=airflow
|
|
54
|
+
uv run dagnose check
|
|
55
|
+
uv run dagnose worker --once
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
For Airflow 2, set `DAGNOSE_AIRFLOW_URL=http://localhost:8081` and
|
|
59
|
+
`DAGNOSE_HOME=dev/airflow2/dagnose-data`.
|
|
60
|
+
|
|
61
|
+
## End-to-end checks
|
|
62
|
+
|
|
63
|
+
`dev/e2e.py` triggers every demo DAG on a running Airflow, waits for the failures,
|
|
64
|
+
runs the worker, and checks the collected and redacted context and the chat card
|
|
65
|
+
(against a local fake webhook) for each one:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
uv run python dev/e2e.py --airflow 3 # listener plugin and polling
|
|
69
|
+
uv run python dev/e2e.py --airflow 3 --watch api # polling only
|
|
70
|
+
uv run python dev/e2e.py --airflow 2
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Other development scripts
|
|
74
|
+
|
|
75
|
+
| Script | Purpose |
|
|
76
|
+
|---|---|
|
|
77
|
+
| `dev/record_fixtures.py` | Record API traffic and contexts from a running Airflow into `tests/fixtures/` |
|
|
78
|
+
| `dev/diagnose_fixtures.py --yes-spend` | Score the real model on the recorded failures. Calls the model API and costs money |
|
|
79
|
+
| `dev/trigger.py DAG_ID [--times N]` | Trigger DAG runs on any Airflow 2 or 3 (needs a user that may trigger) |
|
|
80
|
+
| `dev/scan_secrets.py` | Fail if a real-looking key is in the files git would commit (also runs in CI) |
|
|
81
|
+
|
|
82
|
+
## Project layout
|
|
83
|
+
|
|
84
|
+
| Path | Contents |
|
|
85
|
+
|---|---|
|
|
86
|
+
| `src/dagnose/plugin/` | Airflow listener plugin: writes failure jobs to the spool, never raises |
|
|
87
|
+
| `src/dagnose/queue.py` | Spool (listener side) and SQLite job queue (worker side) |
|
|
88
|
+
| `src/dagnose/watcher.py` | Finds failed tasks by polling the Airflow REST API |
|
|
89
|
+
| `src/dagnose/collector/` | Airflow REST API client (v1 and v2), cloud logins, logs, git history |
|
|
90
|
+
| `src/dagnose/redactor/` | Secret detection and redaction |
|
|
91
|
+
| `src/dagnose/incidents.py` | Failure fingerprints, repeats and the hourly model limit |
|
|
92
|
+
| `src/dagnose/agent/` | Diagnosis loop, read-only tools, evidence checks, model providers |
|
|
93
|
+
| `src/dagnose/notifier/` | Cards for Slack, Microsoft Teams, Google Chat and email; outbox |
|
|
94
|
+
| `src/dagnose/check.py` | `dagnose check` |
|
|
95
|
+
| `src/dagnose/worker.py` | The pipeline run for each failure |
|
|
96
|
+
| `deploy/` | Kubernetes manifest and ECS task definition |
|
|
97
|
+
| `docs/` | Installation and deployment guides |
|
|
98
|
+
|
|
99
|
+
## Continuous integration
|
|
100
|
+
|
|
101
|
+
| When | Workflow | What runs |
|
|
102
|
+
|---|---|---|
|
|
103
|
+
| Every pull request and push to `main` | `.github/workflows/ci.yml` | Lint and strict type checks; unit tests on Python 3.10 to 3.13 with a coverage gate; end-to-end on real Airflow 3 and 2 in Docker, with the plugin and with polling only; package and container image builds |
|
|
104
|
+
| A tag `vX.Y.Z` | `.github/workflows/release.yml` | All of the above, then publish to PyPI and the container image to ghcr.io, and create a GitHub release |
|
|
105
|
+
| Weekly | `.github/dependabot.yml` | Grouped dependency updates |
|
|
106
|
+
|
|
107
|
+
## Pull requests
|
|
108
|
+
|
|
109
|
+
- Open pull requests against `main`. One topic per pull request.
|
|
110
|
+
- Add or update tests for the behaviour you change. Bugs get a regression test.
|
|
111
|
+
- Keep everything that leaves the process redacted: chat cards, emails, model requests
|
|
112
|
+
and files written to disk.
|
|
113
|
+
- Do not commit keys or real credentials. Test tokens are assembled at runtime so that
|
|
114
|
+
no key-shaped string sits in the repository.
|
|
115
|
+
- By contributing you agree that your contribution is licensed under the Apache
|
|
116
|
+
License 2.0.
|
|
117
|
+
|
|
118
|
+
## Reporting security issues
|
|
119
|
+
|
|
120
|
+
Please do not open a public issue. See [SECURITY.md](SECURITY.md).
|
dagnose-0.1.0/Dockerfile
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Dagnose worker image.
|
|
2
|
+
#
|
|
3
|
+
# docker build -t dagnose .
|
|
4
|
+
# docker run --rm --env-file .env dagnose check
|
|
5
|
+
# docker run -d --env-file .env -v dagnose-data:/data dagnose # worker
|
|
6
|
+
#
|
|
7
|
+
# Configuration is environment variables (DAGNOSE_*); see README.md.
|
|
8
|
+
|
|
9
|
+
FROM python:3.12-slim AS build
|
|
10
|
+
WORKDIR /src
|
|
11
|
+
COPY pyproject.toml README.md ./
|
|
12
|
+
COPY src ./src
|
|
13
|
+
RUN pip install --no-cache-dir build==1.2.2.post1 && python -m build --wheel --outdir /wheels
|
|
14
|
+
|
|
15
|
+
FROM python:3.12-slim
|
|
16
|
+
# git: read the history of the DAG repo when DAGNOSE_GIT_REPO_PATH is mounted.
|
|
17
|
+
RUN apt-get update \
|
|
18
|
+
&& apt-get install -y --no-install-recommends git \
|
|
19
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
20
|
+
COPY --from=build /wheels /wheels
|
|
21
|
+
# All cloud extras, so one image works on AWS (MWAA, Bedrock), Google Cloud (Composer,
|
|
22
|
+
# Vertex AI) and Azure (Entra ID, Foundry).
|
|
23
|
+
RUN whl=$(ls /wheels/*.whl) && pip install --no-cache-dir "${whl}[aws,gcp,azure]" && rm -rf /wheels \
|
|
24
|
+
&& useradd --create-home --uid 50000 dagnose \
|
|
25
|
+
&& mkdir -p /data && chown dagnose /data
|
|
26
|
+
USER dagnose
|
|
27
|
+
ENV DAGNOSE_HOME=/data \
|
|
28
|
+
PYTHONUNBUFFERED=1
|
|
29
|
+
VOLUME ["/data"]
|
|
30
|
+
ENTRYPOINT ["dagnose"]
|
|
31
|
+
CMD ["-v", "worker"]
|