Stop logging refused economy requests at ERROR

Đang mở
#4,219 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

@anth-volk đang làm issue này rồi.

Từ ngày 6/11/2026.

  • #4220 của @anth-volk — đang mở

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Python
Star
18
Fork
33
Merge trung bình
2 ngày 15 giờ
Pull request đã merge (30 ngày)
110

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của PolicyEngine/policyengine-api

Tất cả issue của PolicyEngine/policyengine-api

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.