Fixing issue with collecting delays
(cherry picked from commit 384943fe47c327667fbb21e5ec5ea40e048454a1)
This commit is contained in:
parent
02162353c1
commit
ca63474631
@ -347,10 +347,10 @@ func (e *PostfixExporter) CollectFromLogLine(line string) {
|
||||
}
|
||||
case "smtp":
|
||||
if smtpMatches := lmtpPipeSMTPLine.FindStringSubmatch(remainder); smtpMatches != nil {
|
||||
addToHistogramVec(e.smtpDelays, smtpMatches[2], "before_queue_manager")
|
||||
addToHistogramVec(e.smtpDelays, smtpMatches[3], "queue_manager")
|
||||
addToHistogramVec(e.smtpDelays, smtpMatches[4], "connection_setup")
|
||||
addToHistogramVec(e.smtpDelays, smtpMatches[5], "transmission")
|
||||
addToHistogramVec(e.smtpDelays, smtpMatches[2], "before_queue_manager", "")
|
||||
addToHistogramVec(e.smtpDelays, smtpMatches[3], "queue_manager", "")
|
||||
addToHistogramVec(e.smtpDelays, smtpMatches[4], "connection_setup", "")
|
||||
addToHistogramVec(e.smtpDelays, smtpMatches[5], "transmission", "")
|
||||
if smtpMatches := smtpStatusDeferredLine.FindStringSubmatch(remainder); smtpMatches != nil {
|
||||
e.smtpStatusDeferred.Inc()
|
||||
}
|
||||
|
@ -152,6 +152,21 @@ func TestPostfixExporter_CollectFromLogline(t *testing.T) {
|
||||
smtpTLSConnects: prometheus.NewCounterVec(prometheus.CounterOpts{}, []string{"Verified", "TLSv1.2", "ECDHE-RSA-AES256-GCM-SHA384", "256", "256"}),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Testing delays",
|
||||
args: args{
|
||||
line: []string{
|
||||
"Feb 24 16:18:40 letterman postfix/smtp[59649]: 5270320179: to=<hebj@telia.com>, relay=mail.telia.com[81.236.60.210]:25, delay=2017, delays=0.1/2017/0.03/0.05, dsn=2.0.0, status=sent (250 2.0.0 6FVIjIMwUJwU66FVIjAEB0 mail accepted for delivery)",
|
||||
},
|
||||
removedCount: 0,
|
||||
saslFailedCount: 0,
|
||||
outgoingTLS: 0,
|
||||
smtpdMessagesProcessed: 0,
|
||||
},
|
||||
fields: fields{
|
||||
smtpDelays: prometheus.NewHistogramVec(prometheus.HistogramOpts{}, []string{"stage"}),
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
|
Loading…
Reference in New Issue
Block a user