Page MenuHomePhabricator

PageViewInfo shouldn't log "ERROR" for bad user input (unknown page title)
Closed, ResolvedPublic

Description

It seems that querying /w/api.php?action=query&prop=pageviews&title=Does_not_exists still ends up hitting the RESTBase backends, and logging messages to the PageViewInfo channel with level ERROR, indicating a server failure, when this is in fact a non-error, and not worth logging to Logstash, given it is a client error (Page does not exist), which we don't normally log.

Sample for https://de.wikipedia.org/w/index.php?title=Johan_Landsberg&action=info

Failed fetching https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/de.wikipedia.org/all-access/user/Johan_Landsberg/daily/20170921/20171119: There was a problem during the HTTP request: 404 Not Found
 
type mediawiki
channel PageViewInfo
level ERROR
url https://de.wikipedia.org//w/index.php?title=Johan_Landsberg&action=info

apierror_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.

Sample for https://en.wikivoyage.org/w/api.php?action=query&titles=Talk:Example&prop=pageviews&format=json

Failed fetching https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/en.wikivoyage.org/all-access/user/Talk%3AExample/daily/20170920/20171118: There was a problem during the HTTP request: 404 Not Found

Event Timeline

Krinkle created this task.Nov 20 2017, 11:55 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptNov 20 2017, 11:55 PM
Krinkle updated the task description. (Show Details)
Krinkle renamed this task from PageViewInfo extension should not query backend for known unknown page to PageViewInfo shouldn't log "ERROR" for bad user input (unknown page title).Dec 2 2017, 1:08 AM
Tgr added a subscriber: Tgr.Dec 4 2017, 12:07 AM

It seems that querying /w/api.php?action=query&prop=pageviews&title=Does_not_exists still ends up hitting the RESTBase backends

Why wouldn't it? Getting pageview stats on red links is a sensible thing to do.

Sadly the REST API for pageviews doesn't really differentiate between malformed requests and correctly formed requests for which it doesn't happen to have any data. PageViewInfo tries to work around that but maybe the logic is broken.

(I thought maybe it was connected to Restbase's overall tree relation to pages and change/delete propagation, but if not, and it is actually is capable of counting page views for pages that do not exist, then that is fine to ask for indeed.

But the bottom line remains, that either it should not issue 404, or (more likely) the extension shouldn't log an "ERROR" level message for this case. The latter is the main issue.

Change 428592 had a related patch set uploaded (by Gergő Tisza; owner: Gergő Tisza):
[mediawiki/extensions/PageViewInfo@master] Fix RESTBase error code

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

Tgr added a comment.Apr 24 2018, 9:51 AM

Apparently RESTBase changed its error codes.

Change 428592 merged by jenkins-bot:
[mediawiki/extensions/PageViewInfo@master] Fix RESTBase error code

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

Krinkle closed this task as Resolved.Sep 5 2018, 3:09 AM
Krinkle claimed this task.
Krinkle moved this task from Meta to Resolved on the Wikimedia-production-error board.