Skip to content

Commit 372ac48

Browse files
committed
excluding the error field in successful probe call console messages
Signed-off-by: Kyle Quest <kcq.public@gmail.com>
1 parent 9dd7eb3 commit 372ac48

File tree

1 file changed

+49
-38
lines changed

1 file changed

+49
-38
lines changed

pkg/app/master/probe/http/custom_probe.go

Lines changed: 49 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -450,15 +450,17 @@ probeLoop:
450450
}
451451

452452
if p.printState {
453-
p.xc.Out.Info("redis.probe.call",
454-
ovars{
455-
"status": statusCode,
456-
"output": output,
457-
"port": port,
458-
"attempt": i + 1,
459-
"error": callErrorStr,
460-
"time": time.Now().UTC().Format(time.RFC3339),
461-
})
453+
ov := ovars{
454+
"status": statusCode,
455+
"output": output,
456+
"port": port,
457+
"attempt": i + 1,
458+
"time": time.Now().UTC().Format(time.RFC3339),
459+
}
460+
if callErrorStr != "none" {
461+
ov["error"] = callErrorStr
462+
}
463+
p.xc.Out.Info("redis.probe.call", ov)
462464
}
463465

464466
if err == nil {
@@ -490,15 +492,18 @@ probeLoop:
490492
}
491493

492494
if p.printState {
493-
p.xc.Out.Info("dns.probe.call",
494-
ovars{
495-
"status": statusCode,
496-
"output": output,
497-
"port": port,
498-
"attempt": i + 1,
499-
"error": callErrorStr,
500-
"time": time.Now().UTC().Format(time.RFC3339),
501-
})
495+
ov := ovars{
496+
"status": statusCode,
497+
"output": output,
498+
"port": port,
499+
"attempt": i + 1,
500+
"time": time.Now().UTC().Format(time.RFC3339),
501+
}
502+
if callErrorStr != "none" {
503+
ov["error"] = callErrorStr
504+
}
505+
506+
p.xc.Out.Info("dns.probe.call", ov)
502507
}
503508

504509
if err == nil {
@@ -718,17 +723,21 @@ probeLoop:
718723
callErrorStr = err.Error()
719724
}
720725

721-
p.xc.Out.Info("http.probe.call.ws",
722-
ovars{
723-
"status": statusCode,
724-
"stats.rc": wc.ReadCount,
725-
"stats.pic": wc.PingCount,
726-
"stats.poc": wc.PongCount,
727-
"endpoint": wc.Addr,
728-
"attempt": i + 1,
729-
"error": callErrorStr,
730-
"time": time.Now().UTC().Format(time.RFC3339),
731-
})
726+
ov := ovars{
727+
"status": statusCode,
728+
"stats.rc": wc.ReadCount,
729+
"stats.pic": wc.PingCount,
730+
"stats.poc": wc.PongCount,
731+
"endpoint": wc.Addr,
732+
"attempt": i + 1,
733+
"time": time.Now().UTC().Format(time.RFC3339),
734+
}
735+
736+
if callErrorStr != "none" {
737+
ov["error"] = callErrorStr
738+
}
739+
740+
p.xc.Out.Info("http.probe.call.ws", ov)
732741
}
733742

734743
if err != nil {
@@ -930,15 +939,17 @@ func (p *CustomProbe) call(
930939
}
931940

932941
if p.printState {
933-
p.xc.Out.Info("http.probe.call",
934-
ovars{
935-
"status": statusCode,
936-
"method": cmd.Method,
937-
"endpoint": addr,
938-
"attempt": i + 1,
939-
"error": callErrorStr,
940-
"time": time.Now().UTC().Format(time.RFC3339),
941-
})
942+
ov := ovars{
943+
"status": statusCode,
944+
"method": cmd.Method,
945+
"endpoint": addr,
946+
"attempt": i + 1,
947+
"time": time.Now().UTC().Format(time.RFC3339),
948+
}
949+
if callErrorStr != "none" {
950+
ov["error"] = callErrorStr
951+
}
952+
p.xc.Out.Info("http.probe.call", ov)
942953
}
943954

944955
if err == nil {

0 commit comments

Comments
 (0)