Skip to main content
This page takes you from zero to a passing Varianz test: a local registry, one instrumented function, and a test that overrides its result.

Prerequisites

  • Docker (to run the local registry)
  • One of the supported languages: Python 3.10+, Node.js 22+, Go, or JDK 17+ for Java/Kotlin
  • Access to the Varianz registry image (see Running the registry locally; the SDK packages need no credentials)
1

Run a local registry

The registry is the coordination service every SDK connects to. For local development, run it in-memory with plaintext enabled:
It logs LocalRegistry listening on http://[::]:50051 once ready. See Running the registry locally for TLS and Postgres-backed options.
2

Install the SDK

All Varianz packages are served from pkgs.varianz.io — no credentials needed. Pick your language:
Full per-ecosystem details (Maven, Docker, platform notes) are on the Installation page.
3

Instrument a function

Give one function a VPoint name. The SDK derives its schema from the function’s types and registers it with the registry.
4

Enable the SDK

The SDK is disabled by default — an instrumented service with no configuration behaves as if Varianz weren’t there. Clients are also secure by default: they always verify TLS unless you explicitly allow plaintext, so the second variable below is the opt-in for the local dev registry from step 1 and isn’t used in TLS setups:
Set both variables on the service process and on the test process. On startup the SDK logs one line confirming its state, e.g. [varianz] ENABLED (source: env:VARIANZ_ENABLED).
Java and Kotlin additionally need the varianz-agent attached for interception — the Gradle/Maven plugins do this automatically for test and run tasks. See Configuration.
5

Override it from a test

Insert a CEL stage that replaces the function’s result, wait for the service to confirm delivery, then call the function.
Run the test with your usual runner (pytest, vitest, go test, ./gradlew test). The override applies only inside this test’s session — every other caller still gets the real result.

What just happened

  • The VPoint made pricing/calculate interceptable without changing its behavior — see VPoints.
  • The CEL stage 42.0 replaced the return value for one session — see Stages and Sessions.
  • await_sync_or_fail blocked until the service confirmed it received the stage — see How tests work.

Next steps

Instrument a real service

Class methods, gRPC handlers, service registration, schemas.

Set up session propagation

One-time setup so the session ID flows through your whole service graph.

Override and observe

Conditional overrides, failure injection, and capturing samples.

Test across services

Multi-service flows, mixed-language harnesses.