Skip to content
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
7 changes: 5 additions & 2 deletions internal/controller/nginx/agent/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ func (cs *commandService) CreateConnection(

resource := req.GetResource()
podName := resource.GetContainerInfo().GetHostname()
cs.logger.Info(fmt.Sprintf("Creating connection for nginx pod: %s", podName))
cs.logger.Info(
fmt.Sprintf("Creating connection for nginx pod: %s", podName),
"correlation_id", req.GetMessageMeta().GetCorrelationId(),
)

name, depType := getAgentDeploymentNameAndType(resource.GetInstances())
if name == (types.NamespacedName{}) || depType == "" {
Expand All @@ -96,7 +99,7 @@ func (cs *commandService) CreateConnection(
Error: err.Error(),
},
}
cs.logger.Error(err, "error getting pod owner")
cs.logger.Error(err, "error getting pod owner", "correlation_id", req.GetMessageMeta().GetCorrelationId())
return response, grpcStatus.Errorf(codes.InvalidArgument, "error getting pod owner: %s", err.Error())
}

Expand Down
26 changes: 19 additions & 7 deletions internal/controller/nginx/agent/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,11 @@ func (fs *fileService) GetFileStream(
sizeUint32 = uint32(size) //nolint:gosec // validation check performed on previous line
hash := req.GetFileMeta().GetHash()

fs.logger.V(1).Info("Sending chunked file to agent", "file", req.GetFileMeta().GetName())
fs.logger.V(1).Info(
"Sending chunked file to agent",
"file", req.GetFileMeta().GetName(),
"correlation_id", req.GetMessageMeta().GetCorrelationId(),
)

if err := files.SendChunkedFile(
req.GetMessageMeta(),
Expand Down Expand Up @@ -145,20 +149,28 @@ func (fs *fileService) getFileContents(req *pb.GetFileRequest, connKey string) (
filename := req.GetFileMeta().GetName()
contents, fileFoundHash := deployment.GetFile(filename, req.GetFileMeta().GetHash())
if len(contents) == 0 {
fs.logger.V(1).Info("Error getting file for agent", "file", filename)
fs.logger.V(1).Info(
"Error getting file for agent",
"file", filename,
"correlation_id", req.GetMessageMeta().GetCorrelationId(),
)
if fileFoundHash != "" {
fs.logger.V(1).Info(
"File found had wrong hash",
"hashWanted",
req.GetFileMeta().GetHash(),
"hashFound",
fileFoundHash,
"hash_wanted", req.GetFileMeta().GetHash(),
"hash_found", fileFoundHash,
"correlation_id", req.GetMessageMeta().GetCorrelationId(),
)
}
return nil, status.Errorf(codes.NotFound, "file not found")
}

fs.logger.V(1).Info("Getting file for agent", "file", filename, "fileHash", fileFoundHash)
fs.logger.V(1).Info(
"Getting file for agent",
"file", filename,
"file_hash", fileFoundHash,
"correlation_id", req.GetMessageMeta().GetCorrelationId(),
)

return contents, nil
}
Expand Down
Loading