Page MenuHomePhabricator

URI to use when hitting the Pageviews API on rest-gateway
Closed, ResolvedPublic

Description

The ML team is trying to hit the Pageview API from k8s using the rest-gateway listener in envoy, but we keep ending up in HTTP 404s.

We tried to use the same Restbase URIs listed in https://wikitech.wikimedia.org/wiki/Analytics/AQS/Pageviews, but we quickly realized that they didn't work.

After some tries, this works:

elukey@stat1004:~$ curl -s  https://restbase.discovery.wmnet:7443/wikimedia.org/v1/metrics/pageviews/top/en.wikipedia/all-access/2023/10/23

But the following doesn't:

elukey@stat1004:~$ curl -s https://rest-gateway.discovery.wmnet:4113/wikimedia.org/v1/metrics/pageviews/top/en.wikipedia/all-access/2023/10/23
{"httpCode":404,"httpReason":"Not Found"}

What URI/endpoint should we use if we wanted to get the same result as https://wikimedia.org/api/rest_v1/metrics/pageviews/top/en.wikipedia/all-access/2023/10/23 ?

Thanks in advance :)

Event Timeline

Documentation fail on my part - this endpoint requires the host header of "wikimedia.org" be set. This is to force clients at the edge to not split our caches per-site, but is a bit of an annoying workaround to require internally.

elukey claimed this task.

Right this works!

curl https://rest-gateway.discovery.wmnet:4113/wikimedia.org/v1/metrics/pageviews/top/en.wikipedia/all-access/2023/10/23 -H "Host: wikimedia.org"

Thanks a lot :)