You are browsing a read-only backup copy of Wikitech. The live site can be found at wikitech.wikimedia.org
RESTBase
This page is currently a draft. More information and discussion about changes to this draft on the talk page. |
![]() | FIXME: This document needs expansion |
RESTBase is an API proxy serving the REST API at /api/rest_v1/
. It uses Cassandra as a storage backend.
It is currently running on hosts with the profile::restbase
class.
Deployment and config changes
RESTBase is deployed by Scap.
What to check after a deploy
Deploys to do not always go according to plan, and regressions are not always obvious. Here is a list of things you should check after each deploy:
- Does the API documentation still load? Consider exercising some of the endpoints from the UI (perhaps by requesting an html render).
- Check error logs in logstash.
- Have a look at the metrics in Grafana. Have latencies increased, or error rates jumped? Is memory utilization consistent with expectations? What about storage (op rates, exceptions, etc)?
- Consider making an edit to a page using Visual Editor.
- Take a look at some recent Visual Editor-performed changes (French Wikipedia works great for this, as they use VE by default). Do the diffs looks reasonable?
- Keep a close eye on
#wikimedia-operations
, if someone spots a problem, they're likely to raise the issue there.
Other considerations
Be sure to log all actions ahead of time in #wikimedia-operations
. Don't be shy about including details.
Debugging
To temporarily switch to local logging for debugging, you can change the config.yaml log stanza like this:
logging: name: restbase streams: # level can be trace, debug, info, warn, error - level: info path: /tmp/debug.log
Alternatively, you can log to stdout by commenting out the streams sub-object. This is useful for debugging startup failures like this:
cd /srv/deployment/restbase/deploy/ sudo -u restbase node restbase/server.js -c /etc/restbase/config.yaml -n 0
The -n 0
parameter avoids forking off any workers, which reduces log noise. Instead, a single worker is started up right in the master process.
Analytics and metrics
Hive query for action API & rest API traffic:
use wmf;
SELECT
SUM(IF (uri_path LIKE '/api/rest_v1/%', 1, 0)) as count_rest,
SUM(IF (uri_path LIKE '/w/api.php%', 1, 0)) as count_action
FROM wmf.webrequest
WHERE webrequest_source = 'text'
AND year = 2017
AND month = 9
AND (uri_path LIKE '/api/rest_v1/%' OR uri_path LIKE '/w/api.php%');