Skip to content

Commit

Permalink
fix(contrib/envoyproxy/go-control-plane): adapt to new logging API
Browse files Browse the repository at this point in the history
  • Loading branch information
darccio committed Dec 17, 2024
1 parent 6d786ca commit 64bd049
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions contrib/envoyproxy/go-control-plane/envoy.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@ func (s *appsecEnvoyExternalProcessorServer) Process(processServer envoyextproc.
return nil
}

log.Warn("external_processing: error receiving request/response: %v\n", err)
log.Warnf("external_processing: error receiving request/response: %v\n", err)
return status.Errorf(codes.Unknown, "Error receiving request/response: %v", err)
}

processingResponse, err = envoyExternalProcessingRequestTypeAssert(&processingRequest)
if err != nil {
log.Error("external_processing: error asserting request type: %v\n", err)
log.Errorf("external_processing: error asserting request type: %v\n", err)
return status.Errorf(codes.Unknown, "Error asserting request type: %v", err)
}

Expand All @@ -124,7 +124,7 @@ func (s *appsecEnvoyExternalProcessorServer) Process(processServer envoyextproc.
}

if err != nil {
log.Error("external_processing: error processing request: %v\n", err)
log.Errorf("external_processing: error processing request: %v\n", err)
return err
}

Expand All @@ -135,7 +135,7 @@ func (s *appsecEnvoyExternalProcessorServer) Process(processServer envoyextproc.
}

if err := processServer.SendMsg(processingResponse); err != nil {
log.Warn("external_processing: error sending response (probably because of an Envoy timeout): %v", err)
log.Warnf("external_processing: error sending response (probably because of an Envoy timeout): %v", err)
return status.Errorf(codes.Unknown, "Error sending response (probably because of an Envoy timeout): %v", err)
}

Expand Down Expand Up @@ -194,7 +194,7 @@ func envoyExternalProcessingRequestTypeAssert(req *envoyextproc.ProcessingReques
}

func processRequestHeaders(ctx context.Context, req *envoyextproc.ProcessingRequest_RequestHeaders) (*envoyextproc.ProcessingResponse, *currentRequest, bool, error) {
log.Debug("external_processing: received request headers: %v\n", req.RequestHeaders)
log.Debugf("external_processing: received request headers: %v\n", req.RequestHeaders)

request, err := newRequest(ctx, req)
if err != nil {
Expand Down Expand Up @@ -242,7 +242,7 @@ func propagationRequestHeaderMutation(span ddtrace.Span) (*envoyextproc.Processi
}

if len(newHeaders) > 0 {
log.Debug("external_processing: injecting propagation headers: %v\n", newHeaders)
log.Debugf("external_processing: injecting propagation headers: %v\n", newHeaders)
}

headerValueOptions := make([]*envoycore.HeaderValueOption, 0, len(newHeaders))
Expand Down Expand Up @@ -270,7 +270,7 @@ func propagationRequestHeaderMutation(span ddtrace.Span) (*envoyextproc.Processi
}

func processResponseHeaders(res *envoyextproc.ProcessingRequest_ResponseHeaders, currentRequest *currentRequest) (*envoyextproc.ProcessingResponse, error) {
log.Debug("external_processing: received response headers: %v\n", res.ResponseHeaders)
log.Debugf("external_processing: received response headers: %v\n", res.ResponseHeaders)

if err := createFakeResponseWriter(currentRequest.wrappedResponseWriter, res); err != nil {
return nil, status.Errorf(codes.InvalidArgument, "Error processing response headers from ext_proc: %v", err)
Expand All @@ -296,7 +296,7 @@ func processResponseHeaders(res *envoyextproc.ProcessingRequest_ResponseHeaders,
return response, nil
}

log.Debug("external_processing: finishing request with status code: %v\n", currentRequest.fakeResponseWriter.status)
log.Debugf("external_processing: finishing request with status code: %v\n", currentRequest.fakeResponseWriter.status)

// Note: (cf. comment in the stream error handling)
// The end of stream bool value is not reliable
Expand Down

0 comments on commit 64bd049

Please sign in to comment.