Options
PassClientOption functions as variadic arguments to NewClient. All options are optional — the defaults are production-safe for most services.
Environment variable — TRULAYER_DRY_RUN
Set TRULAYER_DRY_RUN to 1, true, or yes (case-insensitive) to disable all network calls. The SDK constructs traces and spans normally, but nothing is sent to the ingest API.
SubmitFeedback is also a no-op and returns nil.
If you call NewClient with an empty API key and TRULAYER_DRY_RUN is not set, the SDK logs a warning via log.Printf and no traces will be sent. Always set the env var explicitly in CI and local development to silence the warning.
Example — production
Example — local / offline
For CI pipelines, local development without a TruLayer API key, or any context where you want zero network activity:WithBaseURL when you want to assert on the captured payloads in tests rather than silently discarding them. See Testing for the recommended net/http/httptest pattern.
Flush control
Flush blocks until all enqueued traces have been attempted. Pass a context to set a deadline:
Shutdown performs a final flush and stops the background goroutine. In long-lived servers, wire it into your graceful-shutdown hook:
NewTrace calls after Shutdown still succeed, but the resulting traces will not be sent.