Go Client SDK
The traceway package is the core SDK for instrumenting Go applications. It captures traces, exceptions, messages, metrics, and spans.
Installation
go get go.tracewayapp.comPackages
| Package | Import | Purpose |
|---|---|---|
| Core | go.tracewayapp.com | All tracing, exception, message, metric, and span APIs |
| Gin Middleware | go.tracewayapp.com/tracewaygin | Automatic instrumentation for Gin applications |
| HTTP Middleware | go.tracewayapp.com/tracewayhttp | Automatic instrumentation for net/http servers |
| DB Instrumentation | go.tracewayapp.com/tracewaydb | Automatic span creation for database/sql operations |
When to Use Core vs Middleware
Use middleware (Gin or HTTP) when your application serves HTTP requests. The middleware handles initialization, trace creation, panic recovery, and data capture automatically.
Use the core package directly when:
- Running background tasks or workers (use
MeasureTaskorStartTrace) - Capturing exceptions outside of HTTP context (use
CaptureException) - Sending messages (use
CaptureMessage) - Adding spans to traced operations (use
StartSpan) - Initializing Traceway without middleware (use
Init)
Getting Your Project Token
Before using the SDK, you need a project token from your Traceway instance:
- Register an account on your Traceway dashboard
- Create an organization
- Create a project — select your framework (e.g., "Go - Gin")
- Copy the generated project token (UUID format)
Next Steps
- Initialization — Connection string format and all configuration options
- Traces — Recording HTTP requests and background tasks
- Exceptions — Capturing errors and panics
- Spans — Timing sub-operations