diff --git a/internal/endpoint/smtp/metrics.go b/internal/endpoint/smtp/metrics.go index 509241bc..8c9a7188 100644 --- a/internal/endpoint/smtp/metrics.go +++ b/internal/endpoint/smtp/metrics.go @@ -26,7 +26,7 @@ var ( Namespace: "maddy", Subsystem: "smtp", Name: "started_transactions", - Help: "Amount of SMTP trasanactions started", + Help: "Amount of SMTP transactions started", }, []string{"module"}, ) @@ -35,7 +35,7 @@ var ( Namespace: "maddy", Subsystem: "smtp", Name: "smtp_completed_transactions", - Help: "Amount of SMTP trasanactions successfully completed", + Help: "Amount of SMTP transactions successfully completed", }, []string{"module"}, ) @@ -44,7 +44,7 @@ var ( Namespace: "maddy", Subsystem: "smtp", Name: "aborted_transactions", - Help: "Amount of SMTP trasanactions aborted", + Help: "Amount of SMTP transactions aborted", }, []string{"module"}, ) diff --git a/internal/target/queue/queue.go b/internal/target/queue/queue.go index 264a70fb..4bea9053 100644 --- a/internal/target/queue/queue.go +++ b/internal/target/queue/queue.go @@ -89,7 +89,6 @@ import ( // partialError describes state of partially successful message delivery. type partialError struct { - // Underlying error objects for each recipient. Errs map[string]error @@ -129,7 +128,6 @@ type Queue struct { // Retry delay is calculated using the following formula: // initialRetryTime * retryTimeScale ^ (TriesCount - 1) - initialRetryTime time.Duration retryTimeScale float64 maxTries int @@ -635,6 +633,9 @@ func (q *Queue) removeFromDisk(msgMeta *module.MsgMetadata) { if err := os.Remove(metaPath); err != nil { dl.Error("failed to remove meta-data from disk", err) } + + queuedMsgs.WithLabelValues(q.name, q.location).Dec() + dl.Debugf("removed message from disk") } @@ -704,6 +705,8 @@ func (q *Queue) readDiskQueue() error { ID: id, }) loadedCount++ + + queuedMsgs.WithLabelValues(q.name, q.location).Inc() } if loadedCount != 0 { @@ -762,6 +765,8 @@ func (q *Queue) storeNewMessage(meta *QueueMetadata, header textproto.Header, bo return nil, err } + queuedMsgs.WithLabelValues(q.name, q.location).Inc() + return buffer.FileBuffer{Path: bodyPath, LenHint: body.Len()}, nil }