Configure experiments with stream and contextual attributes

Update frontend and backend for experiments with contextual attributes and stream name:

  • Include stream name and contextual attributes for experiments to:
    • forms, components, views
    • query, services, controller
    • store
    • endpoint
    • mocks and tests
  • Extract contextual attributes as a service

The base endpoint /api/v1/experiments now looks like:

[
  {
    "name": "ready-but-not-running-yet-experiment",
    "start": "2026-03-04T14:30:00Z",
    "end": "2026-03-20T14:30:00Z",
    "sample_rate": {
      "default": 0,
      "0.1": [
        "frwiki"
      ],
      "0.001": [
        "enwiki"
      ]
    },
    "groups": [
      "control",
      "treatment"
    ],
    "stream_name": "product_metrics.web_base",
    "contextual_attributes": [
      "page_title",
      "page_id"
    ]
  },
  {
    "name": "now-running-logged-out-experiment-1",
    "start": "2026-02-27T14:30:00Z",
    "end": "2026-03-13T14:30:00Z",
    "sample_rate": {
      "default": 0,
      "0.1": [
        "eswiki"
      ],
      "0.001": [
        "enwiki"
      ]
    },
    "groups": [
      "control",
      "treatment"
    ],
    "stream_name": "product_metrics.app_base",
    "contextual_attributes": [
      "page_wikidata_qid",
      "page_is_redirect",
      "page_user_groups_allowed_to_edit",
      "mediawiki_version",
      "mediawiki_site_content_language",
      "mediawiki_site_content_language_variant"
    ]
  },
...

While the varnish, mediawiki, analytics remain the same.

Experiments now similarly have the Schema component included in their launch and update forms.

Testing Instructions:

  • Navigate to the base experiments endpoint - http://localhost/api/v1/experiments and verify keys
  • Create/save a new experiment and instrument with contextual attributes
  • Read/update new experiment and instrument with contextual attributes

Closes T408186

Edited by Clare Ming

Merge request reports

Loading