Skip to content

Log JSON as strings not an array of bytes #14215

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func (o *Orchestrator) ResolveBaseImage(ctx context.Context, req *protocol.Resol

reqs, _ := protojson.Marshal(req)
safeReqs, _ := log.RedactJSON(reqs)
log.WithField("req", safeReqs).Debug("ResolveBaseImage")
log.WithField("req", string(safeReqs)).Debug("ResolveBaseImage")

reqauth := o.AuthResolver.ResolveRequestAuth(req.Auth)

Expand All @@ -173,7 +173,7 @@ func (o *Orchestrator) ResolveWorkspaceImage(ctx context.Context, req *protocol.

reqs, _ := protojson.Marshal(req)
safeReqs, _ := log.RedactJSON(reqs)
log.WithField("req", safeReqs).Debug("ResolveWorkspaceImage")
log.WithField("req", string(safeReqs)).Debug("ResolveWorkspaceImage")

reqauth := o.AuthResolver.ResolveRequestAuth(req.Auth)
baseref, err := o.getBaseImageRef(ctx, req.Source, reqauth)
Expand Down
4 changes: 2 additions & 2 deletions components/ws-manager/pkg/manager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -1360,12 +1360,12 @@ func (m *Manager) onChange(ctx context.Context, status *api.WorkspaceStatus) {
if status.Conditions.Failed != "" {
status, _ := protojson.Marshal(status)
safeStatus, _ := log.RedactJSON(status)
clog.WithField("status", safeStatus).Error("workspace failed")
clog.WithField("status", string(safeStatus)).Error("workspace failed")
}
if status.Phase == 0 {
status, _ := protojson.Marshal(status)
safeStatus, _ := log.RedactJSON(status)
clog.WithField("status", safeStatus).Error("workspace in UNKNOWN phase")
clog.WithField("status", string(safeStatus)).Error("workspace in UNKNOWN phase")
}
}

Expand Down