Make sure you have followed this installation guide to set up the Tusk Drift CLI and SDK before recording and replay your first suite of tests.
Record and replay your first trace
1
Set sampling to 100% temporarily
Update
.tusk/config.yaml
to set recording.sampling_rate
to 1.0
to capture all traffic while testing.2
Start the service in record mode
3
Generate traffic
Manually hit a simple endpoint that includes some database and/or network calls. For example:
4
Stop recording
Stop the server after a few seconds with
Ctrl+C
and allow time for recorded traces to be exported.5
List and replay traces
In your project directory, you can view the list of recorded traces by running:You can select which ones to replay as tests locally. Successful replay confirms deterministic behavior with outbound calls mocked from recordings.If you’d like to replay all traces and export the traces to Tusk cloud, run the following:The
--cloud
flag works for tusk list
too.Rollout guidance
-
Start recording in staging with
sampling_rate
≤ 0.1; expand to production and increasing sampling rate after validating fidelity and coverage. -
Keep
export_spans
enabled to use our cloud platform for AI-powered analysis. -
Enable service logs when investigating issues. Logs are written under
.tusk/logs/
when enabled. - Gate production rollout behind a feature flag or environment toggle.
-
Integrate replay in CI to block regressions before merge (run
tusk run
in your pipeline).
Troubleshooting
1. No traces are recorded
- Confirm
recording.sampling_rate
is not0
(set to1.0
while testing). - Verify
tdSdk.markAppAsReady()
is called after the server starts. - Ensure the endpoint is not excluded by your configuration.
2. Failure to replay traces
- Re-run the tests with service logs (logs from the SDK will also be present):
Read the log file in
.tusk/logs
to investigate the error. Optionally, to get the full debug logs including the service logs, run: - Start with a simpler endpoint (no auth or minimal dependencies) to validate setup.
- Confirm your dependency versions are within supported ranges listed above.
3. Lack of package compatibility
If you rely on packages outside the supported technologies or version ranges listed above, reach out to support@usetusk.ai for guidance.FAQ
How does Drift handle PII and sensitive data?
How does Drift handle PII and sensitive data?
You can configure custom redaction rules for specific data patterns and provide explicit deny lists for endpoints and domains. All data is encrypted in transit and at rest, and we follow SOC 2 Type II compliance standards.
Will Drift impact my application's performance?
Will Drift impact my application's performance?
Drift is designed to have minimal performance impact—you can expect a 5% performance overhead. The SDK uses asynchronous recording and batching to avoid blocking your API responses.
What happens if my API schema changes?
What happens if my API schema changes?
Drift automatically detects schema changes and updates its understanding of your API. It will flag breaking changes as potential issues while allowing backward-compatible changes to pass through.