sillygod / cdp-cache

a caddy 2 proxy cache plugin
MIT License
119 stars 17 forks source link

Simplify error output #16

Closed chinajuanbob closed 4 years ago

chinajuanbob commented 4 years ago

Current:

{"level":"error","ts":1592821617.1456428,"logger":"http.handlers.http_cache","msg":"cache handler","error":"no precollect content"}
goroutine 311 [running]:
runtime/debug.Stack(0x212d112, 0x0, 0x0)
        /usr/local/go/src/runtime/debug/stack.go:24 +0xab
runtime/debug.PrintStack()
        /usr/local/go/src/runtime/debug/stack.go:16 +0x34
github.com/sillygod/cdp-cache.(*Handler).ServeHTTP(0xc0006a3040, 0x7f0c4591de50, 0xc0008a00a0, 0xc0004c9700, 0x3c2e920, 0xc00095a360, 0x0, 0x0)
        /go/pkg/mod/github.com/sillygod/cdp-cache@v0.3.3/handler.go:328 +0x6f2
github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1(0x7f0c4591de50, 0xc0008a00a0, 0xc0004c9700, 0xc00095a930, 0x3c2f8e0)
        /go/pkg/mod/github.com/caddyserver/caddy/v2@v2.0.0/modules/caddyhttp/routes.go:256 +0x7b
github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP(0xc00095a390, 0x7f0c4591de50, 0xc0008a00a0, 0xc0004c9700, 0x0, 0x0)
        /go/pkg/mod/github.com/caddyserver/caddy/v2@v2.0.0/modules/caddyhttp/caddyhttp.go:58 +0x52
github.com/hairyhenderson/caddyprom.Metrics.ServeHTTP.func1(0x7f0c4591de50, 0xc0008a00a0, 0xc0004c9700)
        /go/pkg/mod/github.com/hairyhenderson/caddyprom@v0.0.0-20200618131021-07fb0065894a/caddyprom.go:95 +0x72
net/http.HandlerFunc.ServeHTTP(0xc000520120, 0x7f0c4591de50, 0xc0008a00a0, 0xc0004c9700)
        /usr/local/go/src/net/http/server.go:2012 +0x52
github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerResponseSize.func1(0x7f0c4591de50, 0xc0008a0050, 0xc0004c9700)
        /go/pkg/mod/github.com/prometheus/client_golang@v1.7.0/prometheus/promhttp/instrument_server.go:196 +0x105
net/http.HandlerFunc.ServeHTTP(0xc00095a5a0, 0x7f0c4591de50, 0xc0008a0050, 0xc0004c9700)
        /usr/local/go/src/net/http/server.go:2012 +0x52
github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerDuration.func1(0x7f0c4591de50, 0xc0008a0000, 0xc0004c9700)
        /go/pkg/mod/github.com/prometheus/client_golang@v1.7.0/prometheus/promhttp/instrument_server.go:68 +0x13d
net/http.HandlerFunc.ServeHTTP(0xc00095a750, 0x7f0c4591de50, 0xc0008a0000, 0xc0004c9700)
        /usr/local/go/src/net/http/server.go:2012 +0x52
github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerCounter.func1(0x3c4e040, 0xc0006f6380, 0xc0004c9700)
        /go/pkg/mod/github.com/prometheus/client_golang@v1.7.0/prometheus/promhttp/instrument_server.go:100 +0xf9
net/http.HandlerFunc.ServeHTTP(...)
      ...

Expected:

Output error msg w/o stack for this error

Thanks!

sillygod commented 4 years ago

Hi @chinajuanbob ,

I've also removed the debug print stack in the pr: #21 You can check it!

sillygod commented 4 years ago

@chinajuanbob , it seems that the error stack didn't appear since the last PR merged and don't receive any feedback again. Therefore, I will close this issue a few days later if there is no reply.

sillygod commented 4 years ago

There is no reply to this issue so I think it's resolved.