Stop logging refused economy requests at ERROR

Ouverte
#4,219 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 2 jours

@anth-volk y travaille déjà.

Depuis le 6/11/2026.

  • #4220 par @anth-volk — ouverte

Évaluation

Difficulté
3/5
Temps estimé
1-2 jours
Accessibilité débutants
35/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
À l'abandon
Stack technique
python

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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.

Langage dominant
Python
Étoiles
18
Forks
33
Merge moyen
2 j 15 h
PR mergées (30 j)
110

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de PolicyEngine/policyengine-api

Toutes les issues de PolicyEngine/policyengine-api

Issues similaires

Plus d'issues Python

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.