23 Commits
Author SHA1 Message Date
ddadminandDmitry Dementiev 40633602f5 docs(plans): добавлен план инкрементальной загрузки ETL v2
- Зачем:
  - нужно зафиксировать архитектуру перехода от full refresh к инкрементальной загрузке
  - план служит референсом для реализации и code review
- Что:
  - добавлен plans/incremental-etl-v2.md с полным описанием:
    * архитектура watermark (event_ts + lookback 5min)
    * DDL для meta.etl_watermarks_history с TTL 30 дней
    * SQL шаблоны для всех слоев (ODS, DDS, DM)
    * структура DAG с параллельной загрузкой ODS
    * функции get_watermark и save_watermark
    * алерты Grafana для late arrivals
    * демонстрация late arrivals через комментарии и логи
    * сценарии тестирования
    * оценка трудозатрат (15-16 часов)
- Проверка:
  - файл создан: plans/incremental-etl-v2.md
  - структура соответствует принятой архитектуре
  - все параметры согласованы (TTL, lookback, параллельность)
2026-06-09 17:27:17 +03:00
ddadminandDmitry Dementiev 7c6cfd7d18 docs(docs): обновлён план генератора по интеграции Prometheus
- Зачем:
  - зафиксировать решение об observability генератора на уровне MVP-плана
- Что:
  - добавлены требования по /metrics, scrape_config и target generator:9109
  - добавлен env-параметр GEN_METRICS_PORT
  - обновлены шаг внедрения и критерии успеха
- Проверка:
  - проверен diff только для plans/generator_demo_stream_plan.md
2026-06-09 17:26:31 +03:00
ddadminandDmitry Dementiev cbc2f72871 docs(docs): актуализировано ТЗ и потоки ingest
- Зачем:
  - убрать рассинхрон между кратким ТЗ, архитектурой и планом генератора
- Что:
  - сокращен docs/DE-task.md до формата краткого ТЗ проекта
  - обновлены docs/ARCHITECTURE.md и README.md: bootstrap через kafka_load и steady-stream через generator-service
  - обновлен plans/generator_demo_stream_plan.md: режим steady-stream и тик-публикация
- Проверка:
  - просмотрен git diff по измененным файлам
  - в коммит включены только мои документационные изменения
2026-06-09 17:26:31 +03:00
ddadminandDmitry Dementiev 8d0c8f46fd docs(docs): обновлен план простого автономного генератора
- Зачем:
  - зафиксировать реалистичный MVP без переусложнения
- Что:
  - оставлен один режим steady для автономного генератора
  - добавлена минимальная статистическая модель потока на базе Poisson
  - уточнены минимальные метрики, история batch и короткий roadmap внедрения
- Проверка:
  - проверен diff и итоговое содержимое plans/generator_demo_stream_plan.md
2026-06-09 17:25:17 +03:00
ddadminandDmitry Dementiev 4fbe82e74c docs(docs): add plan for long-running demo data generator
- Why:
  - define a clear architecture for continuous demo data generation
  - ensure visual analytics with realistic scenario-based behavior
- What:
  - add a standalone plan with target architecture and components
  - define demo_visible_v1 scenarios, KPI ranges, and DQ behavior
  - describe Airflow orchestration, observability, rollout stages, and acceptance criteria
- Check:
  - reviewed document structure and consistency in plans/
2026-06-09 17:25:17 +03:00
ddadmin a310bc6c39 fix(monitoring): align airflow statsd mapping and reload flow
- Why:
  - Airflow task metrics were mapped to non-emitted StatsD keys
  - reload-monitoring did not restart statsd-exporter after mapping changes
- What:
  - update StatsD mapping for Airflow 2.10.5 metric names
  - remove problematic catch-all mapping that produced inconsistent series
  - restart statsd-exporter in reload-monitoring flow
  - sync operations runbook and airflow monitoring plan with actual metrics
- Check:
  - make reload-monitoring
  - Prometheus targets: airflow/clickhouse/kafka are UP
  - trigger ddl_init and verify airflow_task_duration_seconds_count
  - verify airflow_task_success_total and airflow_task_failures_total in Prometheus
2026-02-08 22:51:09 +03:00
ddadmin 4917a9a6ad feat(monitoring): add Airflow monitoring via statsd-exporter
- Add statsd-exporter service to docker-compose.yml (prom/statsd-exporter:v0.27.1)
- Add StatsD env vars to airflow-default-env for metrics export
- Add airflow job to prometheus.yml scrape configs
- Add Airflow Overview dashboard (Grafana provisioning)
- Add Airflow alert rules: scheduler down, queue backlog, failures, parse time
- Add configs/statsd_mapping.yml for StatsD → Prometheus conversion
- Use Prometheus naming convention (_total for counters, _seconds for timers)
- Add monitoring plan at plans/monitoring_airflow_plan.md
- Update OPERATIONS.md and Makefile for airflow monitoring

Tested: all 3 jobs (airflow, clickhouse, kafka) showing UP in Prometheus,
metrics flowing (dagbag_size=3, executor slots, heartbeats with _total suffix),
all 4 alert rules loaded in Grafana
2026-02-08 22:27:32 +03:00
ddadmin ae593fd08c feat(monitoring): add Kafka monitoring via kafka-exporter
- Add kafka-exporter service to docker-compose.yml
- Add kafka job to prometheus.yml scrape configs
- Add Kafka Overview dashboard (Grafana provisioning)
- Add Kafka alert rules (broker down, consumer lag, etc.)
- Add make reload-monitoring command for easy updates
- Update OPERATIONS.md with TL;DR and troubleshooting

API verified via Context7:
- /danielqsj/kafka_exporter for exporter config
- /prometheus/docs for scrape_configs format
2026-02-08 21:25:31 +03:00
ddadmin 869c189fe8 refactor(airflow): move DAGs to airflow/dags and update paths
- Why:
  - keep Airflow artifacts under a single airflow/ directory
  - align repository layout with intended project structure
- What:
  - move dags/ to airflow/dags/ and update compose mounts
  - make SQL root resolution work in container and local runs
  - update DAG path references in README, AGENTS, ARCHITECTURE, and plans
  - remove tracked Python cache artifacts from old DAG location
- Check:
  - airflow dags list
  - airflow dags list-import-errors
  - e2e success: ddl_init, kafka_load(limit=50), etl_pipeline
2026-02-08 19:34:10 +03:00
ddadmin 0b75da9c08 docs(docs): align docs with airflow-first ingest workflow
- Why:\n  - User-facing docs mixed Airflow and legacy CLI ingest paths and caused confusion\n- What:\n  - Rework README quick start and status to use DAG chain ddl_init -> kafka_load -> etl_pipeline\n  - Rewrite runbook as canonical Airflow-first execution flow\n  - Sync architecture diagrams/sequence and DQ wording with current SQL and DAG behavior\n- Check:\n  - Verified updated sections and removed stale markers with rg in README.md, docs/ARCHITECTURE.md, plans/runbook.md
2026-02-08 18:52:44 +03:00
ddadmin 1b9991f595 fix(airflow): simplify kafka_load params and align docs
- Why:

  - For DE task we only need full ingest or limit-based sample.

  - load_* and full_load params were redundant and unclear in current flow.

- What:

  - Remove full_load and load_* params from kafka_load DAG contract.

  - Simplify kafka helpers (validate/check files) to fixed 4-stream ingest.

  - Sync AGENTS, README, runbook, architecture and airflow plan docs.

- Check:

  - python3 -m py_compile dags/kafka_load_dag.py dags/utils/kafka_helpers.py

  - Airflow smoke/full runs: ddl_init -> kafka_load -> etl_pipeline (all success).

  - Legacy path: make data && make transform (success).
2026-02-08 18:33:54 +03:00
ddadmin 10f5bc3510 feat(airflow): реализован DAG kafka_load для загрузки в Kafka (фаза 2)
- Добавлен kafka-python==2.0.6 в airflow/requirements.txt
- Создан dags/utils/kafka_helpers.py с функциями:
  - check_kafka_ready() — проверка доступности брокера
  - prepare_topics() — создание/сброс топиков через KafkaAdminClient
  - load_jsonl() — загрузка данных через KafkaProducer (limit=0 = все)
  - validate_load_params(), check_input_files() — валидация
- Создан dags/kafka_load_dag.py с TaskGroup:
  - precheck: check_kafka, check_input_files, validate_load_params
  - ingest: prepare_topics, параллельная загрузка 4 потоков, verify_publish_counts
- Параметры DAG: limit (0 = все), reset_topics, load_* (выбор потоков)
- Обновлена документация: AGENTS.md, README.md, plans/runbook.md,
  plans/airflow_dags_plan.md, docs/ARCHITECTURE.md

Тестирование:
- Подключение к Kafka:  (kafka:29092 доступен, брокер 2.6.0)
- Загрузка данных:  (1000 сообщений — полный файл browser_events)
- Python синтаксис:  (py_compile проходит)
- Структура DAG:  (все 9 задач корректно определены)
2026-02-08 18:13:22 +03:00
ddadmin 4819e10cf8 feat: изменён режим загрузки данных по умолчанию — теперь все записи
- По умолчанию bash ./scripts/load_kafka_data.sh
Resetting topics: browser_events location_events device_events geo_events
Loading mode: full (LIMIT=unset)
Bootstrap (inside container): kafka:29092
Publishing: data/browser_events.jsonl -> browser_events (full)
Publishing: data/device_events.jsonl -> device_events (full)
Publishing: data/geo_events.jsonl -> geo_events (full)
Publishing: data/location_events.jsonl -> location_events (full)
Done. загружает все записи из файлов (вместо 50 строк)
- Для ограничения используется bash ./scripts/load_kafka_data.sh
- Удалён устаревший параметр

Изменённые файлы:
- scripts/load_kafka_data.sh — обновлена логика и документация
- plans/runbook.md — обновлены примеры использования
- plans/kafka_ingest_plan.md — обновлён план реализации

Теперь:
- bash ./scripts/load_kafka_data.sh
Resetting topics: browser_events location_events device_events geo_events
Loading mode: full (LIMIT=unset)
Bootstrap (inside container): kafka:29092
Publishing: data/browser_events.jsonl -> browser_events (full)
Publishing: data/device_events.jsonl -> device_events (full)
Publishing: data/geo_events.jsonl -> geo_events (full)
Publishing: data/location_events.jsonl -> location_events (full)
Done. — все записи (4000 сообщений)
- bash ./scripts/load_kafka_data.sh
Resetting topics: browser_events location_events device_events geo_events
Loading mode: slice (LIMIT=50)
Bootstrap (inside container): kafka:29092
Publishing: data/browser_events.jsonl -> browser_events (first 50 lines)
Publishing: data/device_events.jsonl -> device_events (first 50 lines)
Publishing: data/geo_events.jsonl -> geo_events (first 50 lines)
Publishing: data/location_events.jsonl -> location_events (first 50 lines)
Done. — 50 строк каждого типа (200 сообщений)
2026-02-08 17:21:22 +03:00
ddadmin 284dc3dc1f Move STG->ODS to Airflow batch and align monitoring 2026-02-08 16:36:01 +03:00
ddadmin 9e340bb729 refactor(sql): reorganize sql files into structured directory hierarchy
Move DDL files from flat ddl/ directory to sql/ddl/ with layer-based
subdirectories (stg, ods, dds, dm). Move batch transformation SQL from
jobs/ to sql/ layer directories. Update scripts and documentation to
reflect new paths for improved organization and Airflow integration.
2026-02-07 20:51:51 +03:00
ddadmin 6466921bda docs(airflow): refactor dag implementation plan to separate kafka ingestion
Split Kafka ingestion into a dedicated `kafka_load` DAG to enable independent
experimentation with data loading without triggering the full ETL pipeline.
Restructure implementation phases: Stage 1 uses `make data` for MVP, Stage 2
adds the standalone Kafka DAG, Stage 3 adds monitoring. Update DAG numbering,
parameters, task groups, and acceptance criteria to reflect the new
architecture.
2026-02-07 19:44:37 +03:00
ddadmin 4da6a34e4c docs(airflow): update dag implementation plan for mvp
Consolidate the orchestration strategy by merging `kafka_load` and
`etl_batch_transform` into a unified `etl_pipeline`. Replace BashOperator
dependencies on Kafka CLI with PythonOperators utilizing `kafka-python`.
Add detailed technical specifications for helper functions, MVP stages,
and validation checks to align with current infrastructure constraints.
2026-02-07 00:03:32 +03:00
ddadmin cca315e4f6 docs(airflow): add migration plan for ETL orchestration
Detail the architecture for migrating ETL orchestration from make to
Airflow. Define DAG structures for database initialization, Kafka data
ingestion, batch transformation, and quality monitoring. Include
technical specifications, operator details, and implementation phases.
2026-02-06 23:42:50 +03:00
ddadmin 78b8b29fc7 docs(plans): update ddl architecture to use batch transforms for ods to dds
Replace materialized view joins with batch SQL transformations to avoid
consistency issues with out-of-order data. Document the reasoning for
using batch processing for ODS to DDS layer, including handling of
eventual consistency and versioning in ReplacingMergeTree. Update
data flow diagrams and remove MV creation DDL for DDS tables. Add
documentation for error handling tables and batch transformation jobs.
2026-02-05 23:07:57 +03:00
ddadmin c8564bfe03 docs(plans): add DDL modernization plan and restructure documentation
Add comprehensive plan for migrating executable DDL statements from markdown
to separate SQL files organized by layer. The plan outlines artifact structure,
execution requirements via make/Airflow, and environment parameters.

Existing inline DDL content is now marked as legacy in an appendix section,
providing clear separation between planned implementation and current state.
2026-02-05 22:37:51 +03:00
ddadmin eb80bc1870 feat(infra): add makefile and kafka data loading script
Add build automation via Makefile with targets for docker compose
management, DDL application, and data ingestion. Implement a robust bash
script for loading JSONL demo data into Kafka topics with configurable
options for limits, full dataset loading, and topic reset behavior.
2026-02-05 22:10:48 +03:00
ddadmin 380e8fcff3 docs(plans): fix kafka broker address and add data loading docs
Update Kafka broker address to use internal Docker network port (29092)
instead of external port (9092). Add kafka_ingest_plan.md with detailed
implementation strategy and runbook.md with user instructions.
2026-02-05 21:49:09 +03:00
ddadmin df50e507e5 План трансформаций: JSON → витрины BI
- Описаны слои STG/ODS/DDS/DM и связи потоков (`event_id`/`click_id`)
- Добавлены DDL и MV-пайплайн для ingestion из Kafka (ClickHouse) + типизация/дедуп/DQ
- Добавлены витрины/VIEW для BI (Superset), mermaid-диаграмма и операционные заметки
2026-02-04 22:17:28 +03:00