Installation steps
Install Atatus Go Agent and Required Modules
copygo get go.atatus.com/agent go get go.atatus.com/agent/module/atgoredisv8
Configure Atatus and Set Up Database Connection
copyimport ( "github.com/go-redis/redis/v8" "go.atatus.com/agent" "go.atatus.com/agent/module/atgoredisv8" ) var redisClient *redis.Client 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") redisClient = redis.NewClient(&redis.Options{}) // Redis commands will be reported as spans within the current transaction. redisClient.AddHook(atgoredis.NewHook()) } func handleRequest(w http.ResponseWriter, r *http.Request) { ctx := r.Context () // should be propagated to downstream operations such as database queries , http external API calls. // Perform Redis GET command within request context val, err := redisClient.Get(ctx, "key").Result() ... }
Clean Up Dependencies
copygo mod tidy
Run the Application
copygo run main.go