Page MenuHomePhabricator

PHP xLab SDK: Implement the PHP API for feature code to get the experiment and the assigned group
Closed, ResolvedPublic8 Estimated Story Points

Description

Description

This task is a proposal to create the needed PHP API in the MetricsPlatform extension to start working there on the new PHP xLab SDK following the current approach we prepared for the feature code to deal with the experiment enrollment configuration.

We propose the following:

  • There will be an $experimentManager->getExperiment( $experimentName ) function to get the enrollment details (the assigned group) for the experiment whose name if passed as parameter as an Experiment object
  • The proposed API for the Experiment class is the following:
namespace MediaWiki\Extension\MetricsPlatform\XLab;

interface Experiment {

    /**
     * Gets the group the current user was assigned by the EESA when they were
     * enrolled in this experiment.
     *
     * @return {string|null}
     */
    public function getAssignedGroup(): mixed;

    /**
     * Sends an interaction event associated with this experiment if the EESA
     * enrolled the current user in this experiment.
     */
     public function send( string action, array interactionData ): void;
  }
}

Acceptance criteria

  • MediaWiki\Extension\MetricsPlatform\ExperimentManager has the following new functions:
    • ExperimentManager#getExperiment( string $experimentName ): Experiment
  • The Experiment class is created with the API described above

Event Timeline

phuedx subscribed.

@cjming: I've updated the task description per yesterday's meeting and the notes notes in https://etherpad.wikimedia.org/p/go.

Change #1134668 had a related patch set uploaded (by Clare Ming; author: Clare Ming):

[mediawiki/extensions/MetricsPlatform@master] Update PHP library for experiment enrollment

https://gerrit.wikimedia.org/r/1134668

Milimetric set the point value for this task to 8.

Change #1134668 merged by jenkins-bot:

[mediawiki/extensions/MetricsPlatform@master] Update PHP experiment manager for experiment enrollment

https://gerrit.wikimedia.org/r/1134668