Skip to content

Commit 594495c

Browse files
committed
improve logging when using multiple workspaces
Signed-off-by: Markus Blaschke <mblaschke82@gmail.com>
1 parent f2bbcd9 commit 594495c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

probe.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ func handleProbeRequest(w http.ResponseWriter, r *http.Request) {
8989

9090
resultTotalRecords := 0
9191
for _, workspaceId := range opts.Loganalytics.Workspace {
92+
workspaceLogger := contextLogger.WithField("workspaceId", workspaceId)
93+
9294
// Set options
9395
workspaces := []string{}
9496
queryBody := operationalinsights.QueryBody{
@@ -135,9 +137,9 @@ func handleProbeRequest(w http.ResponseWriter, r *http.Request) {
135137
}
136138
}
137139

138-
contextLogger.Debug("metrics parsed")
140+
workspaceLogger.Debug("metrics parsed")
139141
} else {
140-
contextLogger.Errorln(queryErr.Error())
142+
workspaceLogger.Errorln(queryErr.Error())
141143
http.Error(w, queryErr.Error(), http.StatusBadRequest)
142144
return
143145
}

0 commit comments

Comments
 (0)