Page MenuHomePhabricator

[SPIKE] Explore monitoring and alarm options for Wikimedia APIs
Closed, ResolvedPublic

Description

As part of the work to increase the coverage of our monitoring and alarms for the Wikimedia API ecosystem, we want to check what are possible options that we can use to add alerts for errors in API modules for maintainers to be able to respond to problems early.

We’d like to explore a system that not only allows for alarms to be added to monitoring, but also allows other teams and developers to relatively simply add alarms for their own code and modules.

Open questions to explore

  • What capabilities do our current systems provide
  • Consult with teams that have alarm systems operational
    • What are best practices
    • How configurable are these systems, and how configurable can they be
  • Assess the work
    • Can a simple alarm system be implemented within the quarter with the resourcing we have?
    • First focus: REST APIs. What would it mean to implement only for REST? What would it mean to expand, later, to other APIs? Is there a significant difference?
    • Are there alternatives?
    • What are potential requirements and dependencies?

Event Timeline

BPirkle triaged this task as Medium priority.Aug 6 2025, 7:43 PM
BPirkle removed a project: Epic.
BPirkle subscribed.

I removed the "Epic" tag. I'm guessing it was copied by Phab from the parent task.

After some research and a chat with the Observability team, there are some answers, insights and suggestions for the future.

General insights

  • Wikimedia already utilizes Alertmanager for sending alerts to email, IRC and pagers, managed by the Observability team.
  • Alerts will be sent to a specific slack channel so we will need to see how the messages sent into the channel can be used by multiple teams. Alerts can be sent with their modules, labels and keywords, and there are ways in Slack teams can choose to highlight specific keywords that are relevant to them. This will also be the most simplest straightforward MVP for the system as we learn more about how to adjust it.
  • Once the Slack method is added, it should be possible for teams to set up their own alerts using the regular means (through the grafana UI) to be sent to the alerts slack channel.
  • Alerts depend on the monitoring labels that are sent by Prometheus; currently, the REST API system creates consistent labels that utilize the module names and parameters, and those can be shown in grafana graphs. They can also be used for alerts with threshholds and severities.
  • Alerts can be created from any and all labels that are in Prometheus, regardless of where they come from -- which means that alerts can be cut across monitoring that comes from mediawiki or the API gateway or any other service, as long as the labels are consistent.

Monitoring

  • We should try to preserve the current labels as much as possible, even for the sake of historical and continuous data.
  • Whatever labels are chosen (if changed, or added to the system) we should make sure we strive for consistency across the system (potentially looking at holistic consistency beyond "just" the REST API, if possible)
  • There are recommendations and "best practices" for monitoring across mediawiki code https://www.mediawiki.org/wiki/Manual:Stats#Notes

Recommended next steps

The project is definitely doable within the time period and resourcing for the hypothesis for the quarter.
General next steps are:

  • Add "Slack" as an output for Alertmanager T401730: Add a pathway for Alertmanager to send alerts in Slack
  • Review the current monitoring schema (labels) and decide what might be missing to the type of questions MW Interfaces engineering will want to know about or be alerted for
  • Come up with 1-2 "generic" monitoring label/topics that are cross-cutting, and add them to the code.
  • Set up an alert with threshholds into the new Slack channel
  • Set up 2-3 more general alerts into Slack
  • Provide documentation on how to properly add prometheus to API modules + how to use the available labels + how to set up an alert.

Search for "My Keywords" on this Slack doc page for details on having Slack alert on specific keywords.

Updating to resolved so I can close out the sprint.

See https://phabricator.wikimedia.org/T402074 for implementation work.