Configuration Reference
Tusk Drift can be configured through multiple methods with the following precedence (highest to lowest):- Environment Variables: secrets, as well as common CI settings,
- Initialization Parameters via
initialize(), - Config override file via
--config-overrideflag orTUSK_CONFIG_OVERRIDEenv var, - YAML Configuration in
.tusk/config.yaml, mostly set-and-forget static project settings
.tusk/config.yaml is created in your project root when you run tusk init.
This document is structured as follows: the yaml configuration fields are listed
out according to their parent and their path. You can directly use these field
names in your config. This is followed by env vars and other options that are
only available as env vars or arguments.
Some settings have more specific precedence rules than the general list above.
For example, sampling-rate init params override sampling-rate environment
variables. Each section below calls out the exact override behavior where it
matters.
Config Overrides
You can provide a config override file that is merged on top of the base config. Only the fields you specify in the override file are changed; everything else is preserved from the base config. This is useful for local-only settings like disabling span export or changing the sampling mode without modifying the shared config file. Using the--config-override flag:
TUSK_CONFIG_OVERRIDE env var:
--config-override flag takes precedence over the TUSK_CONFIG_OVERRIDE
env var. Both are overridden by individual environment variables.
Example override file:
.tusk/local-config.yaml
service
Configuration related to your service identity and startup.
service.id
*Required when
export_spans: true
Unique identifier for your service in Tusk Cloud. Used to associate traces with
your specific service.
service.name
Human-readable service name displayed in Tusk Cloud dashboard and CLI output.
service.port
Port number your service runs on, used by CLI for health checks.
service.start.command
Command executed by
tusk run to start your service. Should NOT include
TUSK_DRIFT_MODE environment variable.
service.readiness_check
Configuration for verifying service is ready to accept requests.
service.readiness_check.command
Command to check if service is ready (e.g., curl health endpoint).
Note that your code should have called
mark_app_as_ready before this
endpoint’s first successful response.
service.readiness_check.timeout
Maximum time to wait for readiness check to succeed.
service.readiness_check.interval
Time between readiness check attempts.
Sampling
Tusk Drift supports both fixed sampling and adaptive sampling. In adaptive mode, the SDK starts from a configured base rate and can temporarily reduce recording under local pressure such as exporter backlog or runtime memory pressure.recording.sampling.mode
Selects the sampling strategy for recording live traffic. Supported values are
fixed and adaptive.
- Can be set via environment variable:
TUSK_RECORDING_SAMPLING_MODE
recording.sampling.base_rate
Base fraction of live requests to record during trace collection. In
fixed
mode this is the effective rate. In adaptive mode the SDK may temporarily
reduce below this base rate under pressure.
- Can be set via environment variable:
TUSK_RECORDING_SAMPLING_RATE - Legacy environment variable alias:
TUSK_SAMPLING_RATE - Can be set via initialization parameter:
samplingRate
recording.sampling.min_rate
Lower bound for adaptive sampling after load shedding is applied. This is only
used in
adaptive mode.
recording.sampling.log_transitions
Whether the SDK should emit adaptive-sampling transition logs such as
Adaptive sampling updated (...). Only relevant in adaptive mode.
- Can be set via environment variable:
TUSK_RECORDING_SAMPLING_LOG_TRANSITIONS
recording.sampling_rate
Deprecated legacy alias for
recording.sampling.base_rate. Still supported for
backward compatibility.
traces
traces.dir
Directory where local trace files are stored when not exporting to Tusk Cloud.
recording
recording.export_spans
Whether to export spans to Tusk Cloud backend. If
false, spans are stored
locally only.
- Can be set via environment variable:
TUSK_RECORDING_EXPORT_SPANS
test_execution
test_execution.concurrency
Maximum number of concurrent test executions.
test_execution.timeout
Timeout for individual test executions.
comparison
comparison.ignore_fields
List of field names to ignore during trace comparisons (e.g., timestamps, random IDs).
recording
recording.enable_env_var_recording
Whether to record and replay environment variables. Recommended if your application logic depends on environment variables.
- Can be set via environment variable:
TUSK_ENABLE_ENV_VAR_RECORDING
recording.enable_analytics
Whether to enable anonymous usage analytics collection.
recording.exclude_paths
List of URL paths to exclude from recording (e.g., health checks, metrics endpoints).
tusk_api
tusk_api.url
Base URL for Tusk Cloud API endpoints. Can be changed for local development or
custom/on-prem deployments. If you are using Tusk Cloud, there is very little
need to set this.
- Can be set via environment variable:
TUSK_API_URL
tusk_api.auth0_domain
Auth0 domain used for CLI authentication. Only needed for custom/on-prem deployments.
- Can be set via environment variable:
TUSK_AUTH0_DOMAIN
tusk_api.auth0_client_id
Auth0 client ID used for CLI authentication. Only needed for custom/on-prem
deployments.
- Can be set via environment variable:
TUSK_AUTH0_CLIENT_ID
CLI Communication (Replay Mode)
TUSK_MOCK_SOCKET (Unix Socket)
Unix socket path for CLI communication in local development. Automatically
managed by Tusk CLI.
- Can be set via environment variable:
TUSK_MOCK_SOCKET
TUSK_MOCK_HOST / TUSK_MOCK_PORT (TCP)
TCP connection details for CLI communication in Docker environments.
Automatically set by Tusk CLI in containerized environments.
- Can be set via environment variables:
TUSK_MOCK_HOST,TUSK_MOCK_PORT
Operation Mode
Controls how the SDK operates in your application.
- Can be set via environment variable:
TUSK_DRIFT_MODE
"RECORD": Records traces for all instrumented operations (use in staging/production)"REPLAY": Replays previously recorded traces (automatically set bytusk run, do NOT set manually!). This will disable instrumented packages’ egress traffic."DISABLED": Disables all instrumentation
API Key
*Required when
export_spans: true
Your Tusk Drift API key for authenticating with Tusk Cloud services. Note:
This is a confidential value and should only be provided via environment
variable or initialization parameter, not in YAML configuration.
- Can be set via initialization parameter:
apiKey
Environment
Environment name used for organizing traces (e.g., “development”, “staging”,
“production”).
- If not provided,
NODE_ENVis used as default - Can be set via initialization parameter:
env
Logging
Controls the verbosity of SDK logging.
- Can be set via initialization parameter:
logLevel
'silent', 'error', 'warn', 'info', 'debug'
Transforms Configuration
transforms
PII redaction and data transformation rules for HTTP and Fetch requests.
- Can be set via initialization parameter:
transforms
Complete Configuration Example
.tusk/config.yaml