kamilsk / tracer

🪡 Dead simple, lightweight tracing.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

example with sla

kamilsk opened this issue · comments

func Middleware(handler http.Handler) http.Handler {
  return http.HandlerFunc(func (...) {
    ctx := context.WithValue(req.Context(), key, tracer)
    http.ServeHTTP(rw, req.WithContex(ctx))
    if ctx.Err() != nil {
      // fetch tracer, write trace into Sentry
    }
  })
}