Spanlift

One real run · self-hosted Flagsmith

The new price cache was 27% faster. Four times as many of its users hit errors.

11.9% of the people who got it saw an error instead of a price, and the dashboards looked fine. Spanlift saw it five minutes in, pulled the cache back from 908 users, and left the call for the morning. It A/B tests backend code on real users, with Flagsmith as the judge.

Each window is one user:old codenew codeerror

77 seconds · narrated

One real run, start to finish.

Click through the same run yourself

The damage hides in the average.

2.2%Errors, everyone
0.9%Old code
3.6%New cache

Spanlift splits it per user.

03:06
Experiment running

One window, one user. old / new / error

In the morning, you decide.

03:12It paused itself. Errors rose, over 99% sure.

11.9%of new-code users hit an error, against 2.8%. It was 27% faster.

Flip it to roll out to everyone.
It never ships on its own.

The other button

We pressed it once.

In one test run Flagsmith said the old code was better, and we tapped Approve anyway. Within a minute every request failed, and the service stayed down until the traffic stopped.

That is why Spanlift pauses on its own, and never ships on its own.

21:38
21:39
21:40
21:41approved
21:42
21:43
21:44
21:45
21:46
21:47
Failed requests per minute, from the load generator. Real run, 28 Nov.

How it works

How Spanlift saw it. Three parts, and your service only talks OpenFeature and OpenTelemetry.

01

Split

Your service asks OpenFeature which code each user gets. Flagsmith keeps half the users on the new code, and every request records which half it was.

Span event on every request

feature_flag.key
price_cache
feature_flag.result.variant
cache
feature_flag.context.id
user-0042
experiment.id
1
02

Measure

A Spanlift exporter in the OpenTelemetry Collector turns each traced request into latency and error events for that user, and posts them to Flagsmith.

POST /api/v1/events/

{ "event": "request_latency_ms",
  "identifier": "user-0042",
  "value": 11.4 }
03

Guard

When Flagsmith is sure errors rose, Spanlift pauses the experiment and moves everyone back. Rolling out to everyone always waits for a person.

Two calls to Flagsmith, in this order

PATCH /experiments/1/rollout/
      { "rollout_percentage": 0, ... }
POST  /experiments/1/pause/

Built on Flagsmith

Flagsmith makes every call. Spanlift adds no statistics of its own.

01Split

Who gets the new code

  • Self-hosted Flagsmith 2.295.2, Experimentation oncompose.yaml
  • Multivariate feature with a variant key per armfeatures/mv-options/
  • Go SDK, local evaluation, identity flags, experiment metadataGetIdentityFlags
  • OpenFeature provider that records the variantservice/flags.go

02Measure

What each user felt

  • Experiment metrics: latency should decrease, errors and slow requests should not increaseexperiment-metrics/
  • An exposure and metric events for every traced request, per userPOST /api/v1/events/$flag_exposure
  • Events stored in Flagsmith's own Postgreswarehouse-connections/

03Decide

Flagsmith's statistics, then a person

  • Results and the Bayesian chance to win, read on every checkexperiments/{id}/results/…/refresh/
  • The pause: rollout to 0%, then pauserollout/pause/
  • Resume, or ship once a person approvesstart/complete/
  • Spanlift runs on Flagsmith too: its auto-pause is a flag, its guardrail defaults are remote configGET /api/v1/flags/spanlift_autopausespanlift_guardrail

Works with

Spanlift SDKs in your service.It uses OpenFeature and OpenTelemetry. You do need one small piece: a 40-line Flagsmith provider that reports experiment enrollment, because the stock provider drops it. Spanlift ships it.

The whole Collector side

exporters:
  flagsmith:
    endpoint: http://flagsmith:8000
    environment_key: ${env:FLAGSMITH_ENVIRONMENT_KEY}
    feature: price_cache
    slow_threshold: 300ms

Run it yourself work in progress

Clone, then four commands.

  1. 1Clonegit clone github.com/Malaydewangan09/spanlift
  2. 2Start Flagsmith

    Self-hosted, with its own Postgres.

    docker compose up -d postgres migrate-db flagsmith flagsmith-task-processor
  3. 3Seed it

    Creates the experiment and writes the keys to .env.

    python3 scripts/seed.py
  4. 4Start Spanlift

    The collector, the demo price API and the controller.

    docker compose up -d --build collector app-db price-api controller
  5. 5Send traffic

    Then open the workspace on :8090. The first pause can come 5 minutes in.

    docker compose --profile load run --rm load

Limits

What it does not do, said up front.

Metrics
Flagsmith has no percentiles, so Spanlift uses averages and a slow request count.
Statistics
The pause is a threshold with a minimum sample, not a sequential test.
Demo
The demo service makes the cache refill the slow path and keeps the old path cheap with a daily rollup, so the guardrail has something to catch.
Accounts
No logins. The workspace is for one team on a local setup, and a decision is signed with a typed name.
Cost
LaunchDarkly sells this on Enterprise. Here it is self-hosted and $0.

Ship at night.
Decide in the morning.

Night story numbers are from a real 20 minute run