Installation steps
Install Atatus Go Agent and Required Modules
copygo get go.atatus.com/agent go get go.atatus.com/agent/module/atredigo
Configure Atatus and Set Up Database Connection
copyimport ( "github.com/gomodule/redigo/redis" "go.atatus.com/agent" "go.atatus.com/agent/module/atredigo" ) var redisPool *redis.Pool // initialized at program startup func main() { // Initialize Atatus tracer using environment variables tracer := atatus.DefaultTracer tracer.Service.LicenseKey = os.Getenv("ATATUS_LICENSE_KEY") tracer.Service.AppName = os.Getenv("ATATUS_APP_NAME") tracer.Service.Tracing = os.Getenv("ATATUS_TRACING") tracer.Service.Analytics = os.Getenv("ATATUS_ANALYTICS") } func handleRequest(w http.ResponseWriter, req *http.Request) { // Wrap and bind redis.Conn to the HTTP request context. // If the HTTP server is instrumented with Atatus APM (e.g. using athttp), // Redis commands will be reported as spans within the request’s transaction. conn := atredigo.Wrap(redisPool.Get()).WithContext(ctx) defer conn.Close() // Use conn.Do or conn.DoWithTimeout to execute Redis commands // ... }
Clean Up Dependencies
copygo mod tidy
Run the Application
copygo run main.go