Page MenuHomePhabricator

[Page analytics] Valid request returns 400 status code
Closed, ResolvedPublicBUG REPORT

Description

url_full = 'http://localhost:8087/metrics/pageviews/top-per-country/US/all-access/2021/05/05'

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"}

This request us returning 400 as per Emeka , I could not debug the same.

Related Objects

StatusSubtypeAssignedTask
StalledNone
In ProgressNone
In Progress DAbad
ResolvedNone
ResolvedBUG REPORTNone

Event Timeline

Atieno added a subscriber: EChukwukere-WMF.

Hi @EChukwukere-WMF does the error have some detailed response..?

@Atieno yes typically it returns the error in a json error schema. Right now I am not able to get it for you because I am now see a 500 status error for that endpoint with the same country, access, year month and day. See the code below ( this is a python code)

import requests

prod_url = 'http://localhost:8087/metrics/pageviews/top-per-country/US/all-access/2021/05/05'

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())

This returns a 500 status code and now returns returns error :

{'detail': ['not found'], 'method': 'get', 'status': 500, 'title': 'Internal Server Error', 'type': 'about:blank', 'uri': 'http://localhost:8087/metrics/pageviews/top-per-country/US/all-access/2021/05/05'}

Could this be because we do not have data for that year and dates already pulled in ?

cc @BPirkle

Aklapper renamed this task from [Page analytics]Valid request returns 400 status code to [Page analytics] Valid request returns 400 status code.Mar 15 2023, 4:19 PM

@EChukwukere-WMF and I discussed this in Slack.

There are multiple things going on here:

  • @codebug 's MR 62 from GitLab needs moved to the new page-analytics repo in gerrit, so it can be reviewed and merged.
  • the testing env does not have data for the dates that Emeka is trying to test. It does have data for January of that year, so Emeka can adjust the dates in his test
  • the testing env does not have data for country code US for that endpoint, but it does have data for country code GB, so Emeka can adjust the country code

@BPirkle thanks alot for clarifying that. Now I know where to go check the dates in the data files locally. I was able to change the country code in that test script to GB and it returned a 200 status code and the right data.

I will still wait for Wendy to check in her code so I confirm the one for US and then call it good ( barring any issues)

I will still wait for Wendy to check in her code so I confirm the one for US and then call it good ( barring any issues)

Wendy is just making changes to the code. She isn't adding data to the testing environment. So US will won't work, even after her code is moved and merged.

I'm happily surprised you're getting a 200 with GB. We still need Wendy's MR moved (and she said she'd do that). So let's try again after that. But I think you'll still have to try with GB and not US.

@BPirkle This MR is ready for gerrit but our page analytics repo on gerrit does not have a .gitreview file so I cannot push

https://gerrit.wikimedia.org/r/plugins/gitiles/generated-data-platform/aqs/page-analytics/+/refs/heads/main

Please advise on how to proceed on this. I will be available the first four hours of tomorrow so I can sort this out before I go on vacation

That's a new one for me, but I guess it happens with new gerrit repos?

I've created a change that adds the .gitreview file. Creating that locally allowed me to push to the repo, and the change appears to happily appear:
https://gerrit.wikimedia.org/r/c/generated-data-platform/aqs/page-analytics/+/900824

(The change also fixed the service name in the Makefile and .gitignore file)

Please:

  • Review my change
  • If if it looks good, +2 it (if not, -1 it and tell me what you see that is wrong and I'll fix it)
  • After +2ing, rebase your change
  • Try your push again?

Hopefully you have +2 rights on this repo. But if not, then (assuming the change looks good to you) please +1 with a comment like "Looks good to me but I do not have +2 privileges" and I'll get someone else to +2 it.

All done, Wendy's MR is merged into the gerrit repository now. Thanks Wendy, for getting this done so quickly!