Skip to content

Commit

Permalink
excluding the error field in successful probe call console messages
Browse files Browse the repository at this point in the history
Signed-off-by: Kyle Quest <kcq.public@gmail.com>
  • Loading branch information
kcq committed Oct 19, 2024
1 parent 9dd7eb3 commit 372ac48
Showing 1 changed file with 49 additions and 38 deletions.
87 changes: 49 additions & 38 deletions pkg/app/master/probe/http/custom_probe.go
Original file line number Diff line number Diff line change
Expand Up @@ -450,15 +450,17 @@ probeLoop:
}

if p.printState {
p.xc.Out.Info("redis.probe.call",
ovars{
"status": statusCode,
"output": output,
"port": port,
"attempt": i + 1,
"error": callErrorStr,
"time": time.Now().UTC().Format(time.RFC3339),
})
ov := ovars{
"status": statusCode,
"output": output,
"port": port,
"attempt": i + 1,
"time": time.Now().UTC().Format(time.RFC3339),
}
if callErrorStr != "none" {
ov["error"] = callErrorStr
}
p.xc.Out.Info("redis.probe.call", ov)
}

if err == nil {
Expand Down Expand Up @@ -490,15 +492,18 @@ probeLoop:
}

if p.printState {
p.xc.Out.Info("dns.probe.call",
ovars{
"status": statusCode,
"output": output,
"port": port,
"attempt": i + 1,
"error": callErrorStr,
"time": time.Now().UTC().Format(time.RFC3339),
})
ov := ovars{
"status": statusCode,
"output": output,
"port": port,
"attempt": i + 1,
"time": time.Now().UTC().Format(time.RFC3339),
}
if callErrorStr != "none" {
ov["error"] = callErrorStr
}

p.xc.Out.Info("dns.probe.call", ov)
}

if err == nil {
Expand Down Expand Up @@ -718,17 +723,21 @@ probeLoop:
callErrorStr = err.Error()
}

p.xc.Out.Info("http.probe.call.ws",
ovars{
"status": statusCode,
"stats.rc": wc.ReadCount,
"stats.pic": wc.PingCount,
"stats.poc": wc.PongCount,
"endpoint": wc.Addr,
"attempt": i + 1,
"error": callErrorStr,
"time": time.Now().UTC().Format(time.RFC3339),
})
ov := ovars{
"status": statusCode,
"stats.rc": wc.ReadCount,
"stats.pic": wc.PingCount,
"stats.poc": wc.PongCount,
"endpoint": wc.Addr,
"attempt": i + 1,
"time": time.Now().UTC().Format(time.RFC3339),
}

if callErrorStr != "none" {
ov["error"] = callErrorStr
}

p.xc.Out.Info("http.probe.call.ws", ov)
}

if err != nil {
Expand Down Expand Up @@ -930,15 +939,17 @@ func (p *CustomProbe) call(
}

if p.printState {
p.xc.Out.Info("http.probe.call",
ovars{
"status": statusCode,
"method": cmd.Method,
"endpoint": addr,
"attempt": i + 1,
"error": callErrorStr,
"time": time.Now().UTC().Format(time.RFC3339),
})
ov := ovars{
"status": statusCode,
"method": cmd.Method,
"endpoint": addr,
"attempt": i + 1,
"time": time.Now().UTC().Format(time.RFC3339),
}
if callErrorStr != "none" {
ov["error"] = callErrorStr
}
p.xc.Out.Info("http.probe.call", ov)
}

if err == nil {
Expand Down

0 comments on commit 372ac48

Please sign in to comment.