E2E Tests & Benchmarks
End-to-end tests and benchmarks that run against a live OpenMeter stack over HTTP.
Both skip unless OPENMETER_ADDRESS is set.
Run the local stack
make env-local-up # build + start openmeter + infra (docker compose)
make env-local-down # tear down
Server listens on http://localhost:38888. config.yaml is bind-mounted, so config
changes need only make env-local-up (force-recreate), not a full down/up. View service logs from this directory with
docker compose -f docker-compose.infra.yaml -f docker-compose.openmeter.yaml -f docker-compose.openmeter-local.yaml logs -f
The local E2E build stamps the checked-out Git SHA and version v0.0.0-e2e.
When running TestLedgerWriterBuild against a separately built server, set
OPENMETER_E2E_EXPECTED_COMMIT_SHA and OPENMETER_E2E_EXPECTED_VERSION to
its build inputs. Set the expected version to an empty string for an unversioned build.
RTE client
The opt-in RTE scenario runs against separate API and RTE processes. It creates grants
over the API, publishes calculation requests to Kafka and reads the worker's stored
results through the RTE client. Run these commands from the e2e directory in the
repository's development shell.
export OPENMETER_E2E_EXTRA_COMPOSE_FILES="-f docker-compose.rte.yaml"
make env-local-up
make wait-local
make test-rte
make env-local-down
The overlay enables RTE and exposes the local Kafka broker at localhost:39092.
The default suite omits the rte_e2e build tag. For service-backed tests and the worker
scenario that also exercises metered entitlements and late usage, see the RTE test guide.
Benchmarks
BenchmarkEntitlementAccessQuery measures POST /api/v3/openmeter/entitlement-access/query latency
across a customers × features grid. Seeds boolean entitlements (no usage events).
make bench-entitlement-access # 1x1 baseline + 10/50/100 diagonal
make bench-entitlement-access-matrix # full 3x3 customers x features matrix
Overridable vars (defaults shown):
| Var |
Default |
Purpose |
OPENMETER_ADDRESS |
http://localhost:38888 |
target server |
BENCHTIME |
20x |
iterations per sub-benchmark |
COUNT |
1 |
repeat count (use >1 for benchstat variance) |
For variance / before-after comparison:
make bench-entitlement-access COUNT=10 | tee baseline.txt
benchstat baseline.txt # mean ± %CV
benchstat baseline.txt after.txt # delta + p-value
ns/op = mean of sequential request latencies (no concurrency, no tail percentiles).
Boolean entitlements skip the metered/ClickHouse balance path — a relative algorithmic
baseline, not a production-latency oracle.
Traces (optional)
OpenMeter runs in a container, so OTLP must target the host, not container loopback.
Point the OTLP exporters in e2e/config.yaml at host.docker.internal:4317 and run a
collector on the host (e.g. grafana/otel-lgtm). Then query per-size latency percentiles
in Grafana (Tempo, TraceQL metrics):
{ name = "entitlement_access.Query" && span.customer_key_count = 100 && span.feature_key_count = 100 }
| quantile_over_time(duration, 0.5, 0.9, 0.95, 0.99)
High-fan-out requests emit thousands of SQL spans; bump Tempo's max_bytes_per_trace
(default 5MB) or traces get dropped at ingest.
Standard e2e tests
make test-http-errors runs the shared error handling contract through real HTTP/1,
HTTP/2, gRPC, and PostgreSQL connections. The test handlers provide controlled
failures without adding fault injection to production endpoints. These scenarios
start their own HTTP/gRPC servers and run as part of make test-base.
For an existing PostgreSQL instance, override OPENMETER_E2E_POSTGRES_URL; the
default is the local compose instance. Without that variable, direct
go test ./httperrors runs the protocol scenarios and skips the SQL scenario.
make test-local # full down → up → go test ./... → down