Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

EventStats: compiled queries endpoint for server-side aggregations

オープン
#116 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

@tmikula-dev がすでに取り組んでいます。

2026年4月13日 から。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
機能追加
明瞭さ
説明が足りない
活発さ
静か
技術スタック
postgresql, python
領域
api, backend, databases

調査の方向性

まず依存関係 #115 を解決し、event_stats_lambda.py にある既存の EventStats のルートおよびハンドラーのフロー、特に ROUTE_HANDLERS と、PR #113 を確認します。レジストリを設計する前に、サポート対象のクエリセットとパラメーター/出力の契約をステークホルダーと確認してください。完了には、routing、registry-lookup、result-shaping の unit test、初期データを投入した testcontainer の統合テスト、および ./ci_local.sh の成功が必要です。

索引モデルが issue の本文から書いたものです。

説明

enhancement
Feature Description

Extend the EventStats Lambda with a compiled queries endpoint — a curated list of predefined, server-executed queries (e.g. "failed jobs in the last 7 days", "job count aggregated by catalog") that consumers can invoke by name. Rather than pushing aggregation logic into the client or BI tool, the heavy lifting runs inside PostgreSQL and only the final result set is returned over the wire.

Problem / Opportunity

The current POST /stats/{topic_name} endpoint returns raw paginated rows. Consumers (dashboards, reports, downstream tools) re-derive the same aggregations repeatedly on the client side — wasting bandwidth, duplicating logic, and making results inconsistent across consumers. Predefined server-side queries centralise that logic, reduce payload sizes significantly, and allow PostgreSQL query planning to optimise repeated patterns.

Acceptance Criteria
  • A new route (e.g. POST /stats/{topic_name}/query/{query_name}) accepts a query identifier and an optional parameter bag (e.g. time window, tenant filter).
  • A SUPPORTED_QUERIES registry maps each query_name to its SQL template and accepted parameters — unknown names return 400.
  • Queries are executed server-side; only the aggregated result is returned (no raw row streaming).
  • The endpoint is protected by the same JWT auth and per-topic ACL as the rest of EventStats.
  • Unknown or unsupported query_name values produce a clear 400 error, not a 500.
  • Unit tests cover routing, registry lookup, and each query's result shaping.
  • Integration tests validate at least one aggregation query end-to-end against a seeded testcontainer database.
  • All quality gates pass (./ci_local.sh).

Note for implementer: the concrete set of queries and their SQL definitions must be identified and agreed upon as part of this issue's implementation. The examples below are starting points only — validate with stakeholders which aggregations are actually needed before writing SQL.

Proposed Solution

Introduce a CompiledQueryRegistry (or extend ReaderPostgres) that maps query names to parameterised SQL templates (using psycopg2 %s / sql.SQL composition — never string interpolation). Each entry declares its accepted input parameters and output schema.

Example candidate queries to evaluate with stakeholders:

  • failed_jobs_last_7d — count and list of jobs with a failure status in the last N days, grouped by pipeline/tenant.
  • aggregation_by_catalog — job count, success rate, and average elapsed time grouped by catalog/source.
  • run_status_summary — distribution of run statuses (running, completed, failed) over a configurable time window.

Route dispatch follows the existing ROUTE_HANDLERS pattern in event_stats_lambda.py. A new HandlerCompiledQuery (or an extension of HandlerStats) handles validation and delegates to the registry.

Dependencies / Related
  • Builds on the EventStats Lambda introduced in PR #113.
  • Connection pooling (#115) should be resolved first to avoid per-query connection overhead under aggregation load.
主要言語
Python
スター
4
フォーク
0
平均マージ
20時間 22分
マージ済み PR(30日)
8

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

AbsaOSS/EventGate のほかの issue

AbsaOSS/EventGate の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。