Docs · Go

Go logging and alerts, in 5 minutes

Your Go app's errors and panics with their stack trace, each request's thread across your services and a phone alert when an order never finishes. One file, no dependencies.

  1. 1

    Install

    // copy estiaje.go into your project (Go 1.18+, in its own estiaje package)

    It's a file with no dependencies: copy it from here. Change "mi-api" to your service's name.

  2. 2

    Your key

    Create your account and put the key in ESTIAJE_TOKEN. Or ask your AI “connect this repo to Estiaje” (the connector). Without the key nothing leaves over the network: you can instrument today.

  3. 3

    Your errors, your panics and each request's thread

    ● Tested in CI
    func main() {
    	defer estiaje.Recuperar(context.Background())   // a panic arrives before it dies
    
    	// each request's thread (and its panics); works the same with chi or gorilla/mux
    	http.ListenAndServe(":8080", estiaje.Middleware(mux))
    }
    func main() {
    	defer estiaje.Recuperar(context.Background())   // a panic arrives before it dies
    
    	r := gin.Default()
    	r.Use(func(c *gin.Context) {   // each request's thread
    		c.Request = c.Request.WithContext(estiaje.ConHilo(c.Request.Context(), c.GetHeader("traceparent")))
    		c.Next()
    	})
    }
    func main() {
    	ctx := estiaje.ConHilo(context.Background(), "")   // a new thread for this job
    	defer estiaje.Esperar()   // last: waits for the sends before exiting
    	defer estiaje.Recuperar(ctx)
    	corte(ctx)
    }
  4. 4

    The process that must finish

    estiaje.Evento(r.Context(), "order.paid", map[string]any{"order_id": o.ID, "amount": o.Total})
    // … when it ships …
    estiaje.Evento(ctx, "order.shipped", map[string]any{"order_id": o.ID})
  5. 5

    The alert

    In the dashboard, under Processes: “every order.paid expects its order.shipped, by order_id, within 30 minutes”. If it never comes, you get a phone, email or Slack alert, with the money at risk.

And if you want more
  • Errors you catch: estiaje.Error(ctx, err, map[string]any{"order_id": o.ID}), with their stack.
  • When calling another service, pass the thread: &http.Client{Transport: estiaje.Transporte{}} and the request with its ctx.
  • Go 1.18+; standard library only.

Everything else is in the full docs.

Create account, 14 days of Pro No card required.