Raven Device Statistics API¶
This page gives an overview of the Raven Device Statistics API, describing its current status, where and how it's developed and deployed, and who is responsible for maintaining it.
The Raven Device Statistics API provides statistics on unique visits recorded on raven.cam.ac.uk over one or more reporting periods.
The API is useful for getting metrics on devices currently used by University members for planning device support.
Devices are grouped by web browser make and operating system.
Reporting periods are the past day, past week and past 30 days.
The Raven Device Statistics API is currently in alpha as part of the wider alpha testing for the API Gateway service.
Technical queries and support should be directed to email@example.com and will be picked up by a member of the team working on the service. To ensure that you receive a response, always direct requests to firstname.lastname@example.org rather than reaching out to team members directly.
Issues discovered in the service or new feature requests should be opened as GitLab issues in the infrastructure project (DevOps only). Non DevOps members may open issues in that project by emailing email@example.com.
The Raven Device Statistics API is currently deployed to the following environments:
The production environment is advertised on the API Gateway developer portal. Other environments are not publicised.
The source code for the Raven Device Statistics API is present as a single Python script within the Raven infrastructure project (DevOps only). The script is run as a Cloud Scheduled Job each hour to update a static device report in a Cloud Storage object.
The Raven stats API is built on the following technologies:
- Google Cloud Storage to provide the live "implementation" of the API backend.
- Google Cloud Functions to run periodic reports.
- Google Cloud Scheduler to trigger periodic reports.
- Google Analytics to provide device detection.
- The API Gateway to publish the API.
A lot of that technology is hidden within our standard scheduled script module.
The following gives an overview of how the Raven Device Statistics API is deployed and maintained.
How and where the Raven Device Statistics API is deployed¶
The Raven Device Statistics API is deployed as both a backend proxied by the API Gateway and a product within the API Gateway itself.
The backend is a Google Storage object which is provisioned with terraform. The content of that object is rendered by a scheduled script.
The proxy is defined in the API Gateway configuration.
Deploying a new release¶
A new release can be deployed by applying the Raven infrastructure terraform.
The GCP scheduled script terraform module sets up a Cloud Monitoring alert which is fired if the script does not complete successfully sufficiently frequently.
If the scheduled script is failing, use the GCP console to look at the logs of the Raven stats Cloud Function in the first instance.