Page MenuHomePhabricator

[Pageviews_top] requests to Invalid projects returns reference to data/country instead of data/project
Open, HighPublic2 Estimated Story PointsBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • Make request call to the pageviews endpoint with invalid project
  • Code below:
import requests


prod_url = 'https://wikimedia.org/api/rest_v1/metrics/pageviews/top/invalid_project_xx/all-access/2019/01/02'

header = {"accept": "application/json",
          "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36"}

response = requests.get(prod_url, headers=header)

print(response.status_code)
print(response.json())

What happens?:
in AQS 2.0 this returns reference message to data and country missing

{
   "detail":"The date(s) you used are valid, but we either do not have data for those date(s), or the country you asked for is not loaded yet. Please check documentation for more information.",
   "method":"get",
   "status":404,
   "title":"Not Found",
   "type":"about:blank",
   "uri":"/metrics/pageviews/top/invalid_project_xx/all-access/2019/01/02"
}

What should have happened instead?:
This should return reference to data/project missing

{
   "type":"https://mediawiki.org/wiki/HyperSwitch/errors/not_found",
   "title":"Not found.",
   "method":"get",
   "detail":"The date(s) you used are valid, but we either do not have data for those date(s), or the project you asked for is not loaded yet.  Please check https://wikimedia.org/api/rest_v1/?doc for more information.",
   "uri":"/analytics.wikimedia.org/v1/pageviews/top/invalid_project_xx/all-access/2019/01/02"
}

Software version (skip for WMF-hosted wikis like Wikipedia):
Pageviews_top service

Event Timeline

EChukwukere-WMF set the point value for this task to 2.
This comment was removed by Sfaci.

Change 960593 had a related patch set uploaded (by Santiago Faci; author: Santiago Faci):

[generated-data-platform/aqs/page-analytics@main] Fixed some issues related to invalid characters and wrong messages

https://gerrit.wikimedia.org/r/960593

Sfaci triaged this task as High priority.

Change 960593 merged by Sg912:

[generated-data-platform/aqs/page-analytics@main] Fixed some issues related to invalid characters and wrong messages

https://gerrit.wikimedia.org/r/960593