mirror of
https://github.com/mjl-/mox.git
synced 2024-12-26 08:23:48 +03:00
track more unexpected panics in metrics
This commit is contained in:
parent
a5006a9090
commit
f6d03a0eab
3 changed files with 7 additions and 2 deletions
|
@ -1903,6 +1903,7 @@ func (c *conn) deliver(ctx context.Context, recvHdrFor func(string) string, msgW
|
|||
if x != nil {
|
||||
c.log.Error("dkim verify panic", mlog.Field("err", x))
|
||||
debug.PrintStack()
|
||||
metrics.PanicInc("dkimverify")
|
||||
}
|
||||
}()
|
||||
defer wg.Done()
|
||||
|
@ -1936,8 +1937,9 @@ func (c *conn) deliver(ctx context.Context, recvHdrFor func(string) string, msgW
|
|||
defer func() {
|
||||
x := recover() // Should not happen, but don't take program down if it does.
|
||||
if x != nil {
|
||||
c.log.Error("dkim verify panic", mlog.Field("err", x))
|
||||
c.log.Error("spf verify panic", mlog.Field("err", x))
|
||||
debug.PrintStack()
|
||||
metrics.PanicInc("spfverify")
|
||||
}
|
||||
}()
|
||||
defer wg.Done()
|
||||
|
|
|
@ -26,6 +26,7 @@ import (
|
|||
"github.com/mjl-/bstore"
|
||||
|
||||
"github.com/mjl-/mox/message"
|
||||
"github.com/mjl-/mox/metrics"
|
||||
"github.com/mjl-/mox/mlog"
|
||||
"github.com/mjl-/mox/mox-"
|
||||
"github.com/mjl-/mox/store"
|
||||
|
@ -68,6 +69,7 @@ func ImportManage() {
|
|||
if x := recover(); x != nil {
|
||||
log.Error("import manage panic", mlog.Field("err", x))
|
||||
debug.PrintStack()
|
||||
metrics.PanicInc("importmanage")
|
||||
}
|
||||
}()
|
||||
|
||||
|
@ -343,6 +345,7 @@ func importMessages(ctx context.Context, log *mlog.Log, token string, acc *store
|
|||
} else {
|
||||
log.Error("import panic", mlog.Field("err", x))
|
||||
debug.PrintStack()
|
||||
metrics.PanicInc("importmessages")
|
||||
}
|
||||
}()
|
||||
|
||||
|
|
|
@ -363,7 +363,7 @@ func logPanic(ctx context.Context) {
|
|||
log := xlog.WithContext(ctx)
|
||||
log.Error("recover from panic", mlog.Field("panic", x))
|
||||
debug.PrintStack()
|
||||
metrics.PanicInc("http")
|
||||
metrics.PanicInc("webadmin")
|
||||
}
|
||||
|
||||
// return IPs we may be listening on.
|
||||
|
|
Loading…
Reference in a new issue