Stop logging refused economy requests at ERROR

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

メンテナーはふだん 2 日以内に返信

@anth-volk がすでに取り組んでいます。

2026年11月6日 から。

  • #4220 @anth-volk による — オープン

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
python

調査の方向性

Read policyengine_api/services/economy_service.py and policyengine_api/services/economy_budget_window_submission.py, then check how the routes distinguish refused requests from other failures. The expected behavior is to log refused requests at WARNING with a refusal message while keeping other failures at ERROR; inspect the telemetry grouping behavior described in the issue to confirm completion.

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

説明

The economy service logs every request it refuses at ERROR, so refused requests form error groups in the daily telemetry error report.

What happens

EconomyService.get_economic_impact (policyengine_api/services/economy_service.py) and get_budget_window_economic_impact (policyengine_api/services/economy_budget_window_submission.py) each wrap their work in except Exception, log "Error getting economic impact" (or "Error getting budget-window economic impact") at ERROR with the exception's type, and re-raise.

That block also runs for requests the routes answer with a client error:

  • 400 for a time_period or budget-window start_year outside the country's years (SPMValidationError with DATASET_YEAR_UNAVAILABLE, added by #4212);
  • 400 for any other ValueError from request validation, such as an unknown UK region;
  • 404 for a policy the country does not have (PolicyNotFoundError).

The telemetry error report reads every record at severity ERROR or above (severity_number >= 500 in .github/scripts/telemetry_error_issues/bigquery.py). A refused request's completion record is INFO (outcome client_error), so the service's own ERROR record is the only record that puts it in an error group, as a message group on the economy route. #4212 now refuses UK economy years outside 2024 to 2032, the main source of #4099, #4216, #4217 and #4218, so each of those refusals would form a new error group.

Expected

A refused request is logged at WARNING, under a message that says it was refused, and adds no record at ERROR. Any other failure is still logged at ERROR, including a ValueError raised after the request passed validation, which the route also answers with 400.

主要言語
Python
スター
18
フォーク
33
平均マージ
2日 15時間
マージ済み PR(30日)
110

環境構築

はじめの一歩

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

PolicyEngine/policyengine-api のほかの issue

PolicyEngine/policyengine-api の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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