4 "github.com/prometheus/client_golang/prometheus"
5 "github.com/prometheus/client_golang/prometheus/promauto"
8var metricPanic = promauto.NewCounterVec(
9 prometheus.CounterOpts{
10 Name: "mox_panic_total",
11 Help: "Number of unhandled panics, by package.",
22 Import Panic = "import"
24 Imapserver Panic = "imapserver"
25 Dmarcdb Panic = "dmarcdb"
26 Mtastsdb Panic = "mtastsdb"
28 Smtpclient Panic = "smtpclient"
29 Smtpserver Panic = "smtpserver"
30 Tlsrptdb Panic = "tlsrptdb"
31 Dkimverify Panic = "dkimverify"
32 Spfverify Panic = "spfverify"
33 Upgradethreads Panic = "upgradethreads"
34 Importmanage Panic = "importmanage"
35 Importmessages Panic = "importmessages"
37 Webadmin Panic = "webadmin"
38 Webapi Panic = "webapi"
39 Webmailsendevent Panic = "webmailsendevent"
40 Webmail Panic = "webmail"
41 Webmailrequest Panic = "webmailrequest"
42 Webmailquery Panic = "webmailquery"
43 Webmailhandle Panic = "webmailhandle"
47 // Ensure the panic counts are initialized to 0, so the query for change also picks
48 // up the first panic.
70 for _, name := range names {
71 metricPanic.WithLabelValues(string(name)).Add(0)
75func PanicInc(name Panic) {
76 metricPanic.WithLabelValues(string(name)).Inc()