Page MenuHomePhabricator

Add label for session type to API metrics
Open, MediumPublic

Description

The metrics for Action API and REST API usage tracking should get a label that allows us to filter them by session type (auth type). The relevant information can be obtained from $session->getProvider() and $session->getProviderMetadata().

Event Timeline

Atieno triaged this task as Medium priority.Feb 27 2026, 8:53 PM
Atieno moved this task from Incoming (Needs Triage) to Backlog on the MW-Interfaces-Team board.

I assume for the REST API this would use rest_api_modules_hit_total / rest_api_errors_total, and for the action API the mediawiki.api-request stream? It's a bit awkward because those are in core but the way to derive the session type is specific to what session providers are used. ($session->getProvider() doesn't have any human-readable identifier, just a class name, which is informative but not very user-friendly; $session->getProviderMetadata() returns an array with structure dependent on the provider, and you need to know the metadata format used by the OAuth extension to be able to tell things like OAuth version.)

So we might want to add a new SessionProvider method that returns a human-readable description of a given session's type.