diff --git a/pkg/clusteragent/action_handler.go b/pkg/clusteragent/action_handler.go index 9ddd56f..f034e95 100644 --- a/pkg/clusteragent/action_handler.go +++ b/pkg/clusteragent/action_handler.go @@ -275,7 +275,7 @@ func (ah *actionHandler) SyncActions() { ah.logger.WithError(err).Error("error while getting actions from the server") } - ah.logger.WithField("actions", r.GetActions()).Debug("received actions from the server") + ah.logger.WithField("actions", r.GetActions()).Trace("received actions from the server") cancel() ah.SetActions(r.GetActions()) diff --git a/pkg/clusteragent/grpc_servers.go b/pkg/clusteragent/grpc_servers.go index a1b4341..c5efa1a 100644 --- a/pkg/clusteragent/grpc_servers.go +++ b/pkg/clusteragent/grpc_servers.go @@ -69,7 +69,7 @@ func (cs *ConfigServer) EnableAddConstraint(value bool) { // - *tarianpb.GetConstraintsResponse: The response containing constraints. // - error: An error if the request fails. func (cs *ConfigServer) GetConstraints(reqCtx context.Context, request *tarianpb.GetConstraintsRequest) (*tarianpb.GetConstraintsResponse, error) { - cs.logger.Debug("Received get config RPC") + cs.logger.Trace("Received get config RPC") ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() @@ -98,7 +98,7 @@ func (cs *ConfigServer) AddConstraint(reqCtx context.Context, request *tarianpb. defer cancel() r, err := cs.configClient.AddConstraint(ctx, request) - return r, fmt.Errorf("AddConstraint: %w", err) + return r, err } // RemoveConstraint removes a constraint from the Tarian server. @@ -121,7 +121,7 @@ func (cs *ConfigServer) RemoveConstraint(reqCtx context.Context, request *tarian r, err := cs.configClient.RemoveConstraint(ctx, request) - return r, fmt.Errorf("RemoveConstraint: %w", err) + return r, err } // Close closes the gRPC connection. @@ -187,7 +187,7 @@ func NewEventServer(logger *logrus.Logger, tarianServerAddress string, opts []gr // - *tarianpb.IngestEventResponse: The response indicating the result of ingesting the event. // - error: An error if the request fails. func (es *EventServer) IngestEvent(requestContext context.Context, request *tarianpb.IngestEventRequest) (*tarianpb.IngestEventResponse, error) { - es.logger.Debug("Received ingest event RPC") + es.logger.Trace("Received ingest event RPC") ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() @@ -195,7 +195,7 @@ func (es *EventServer) IngestEvent(requestContext context.Context, request *tari r, err := es.eventClient.IngestEvent(ctx, request) es.actionHandler.QueueEvent(request.GetEvent()) - return r, fmt.Errorf("IngestEvent: %w", err) + return r, err } // Close closes the gRPC connection and cancels the context. diff --git a/pkg/nodeagent/nodeagent.go b/pkg/nodeagent/nodeagent.go index 0c94e25..a2094aa 100644 --- a/pkg/nodeagent/nodeagent.go +++ b/pkg/nodeagent/nodeagent.go @@ -170,7 +170,7 @@ func (n *NodeAgent) SyncConstraints() { n.logger.WithError(err).Fatal("couldn't get constraints from the cluster agent") } - n.logger.WithField("constraints", r.GetConstraints()).Debug("received constraints from the cluster agent") + n.logger.WithField("constraints", r.GetConstraints()).Trace("received constraints from the cluster agent") cancel() n.SetConstraints(r.GetConstraints()) @@ -568,7 +568,7 @@ func (n *NodeAgent) RegisterViolationsAsNewConstraint(violation *ProcessViolatio response, err := n.configClient.AddConstraint(context.Background(), req) if err != nil { - n.logger.WithError(err).Error("error while registering process constraint") + n.logger.WithError(err).WithField("response", response).Error("error while registering process constraint") } else { n.logger.WithField("response", response).Debug("add constraint response") } diff --git a/pkg/podagent/podagent.go b/pkg/podagent/podagent.go index 39127b8..bfcca5a 100644 --- a/pkg/podagent/podagent.go +++ b/pkg/podagent/podagent.go @@ -238,7 +238,7 @@ func (p *PodAgent) loopSyncConstraints(ctx context.Context) error { // SyncConstraints retrieves and synchronizes constraints from the cluster agent. func (p *PodAgent) SyncConstraints() { - p.logger.Debug("syncing constraints from the cluster agent") + p.logger.Trace("syncing constraints from the cluster agent") ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) r, err := p.configClient.GetConstraints(ctx, &tarianpb.GetConstraintsRequest{Namespace: p.namespace, Labels: p.podLabels}) @@ -246,8 +246,7 @@ func (p *PodAgent) SyncConstraints() { p.logger.WithError(err).Fatal("couldn't get constraints from the cluster agent") } - p.logger.WithField("constraints", r.GetConstraints()).Debug("received constraints from the cluster agent") - + p.logger.WithField("constraints", r.GetConstraints()).Trace("received constraints from the cluster agent") cancel() p.SetConstraints(r.GetConstraints()) diff --git a/pkg/server/config_server.go b/pkg/server/config_server.go index a83116f..e252dcb 100644 --- a/pkg/server/config_server.go +++ b/pkg/server/config_server.go @@ -50,7 +50,7 @@ func (cs *ConfigServer) GetConstraints(ctx context.Context, request *tarianpb.Ge cs.logger.WithFields(logrus.Fields{ "namespace": request.GetNamespace(), "labels": request.GetLabels(), - }).Debug("Received get config RPC") + }).Trace("Received get config RPC") var constraints []*tarianpb.Constraint var err error @@ -228,7 +228,7 @@ func (cs *ConfigServer) GetActions(ctx context.Context, request *tarianpb.GetAct cs.logger.WithFields(logrus.Fields{ "namespace": request.GetNamespace(), "labels": request.GetLabels(), - }).Debug("Received get actions RPC") + }).Trace("Received get actions RPC") var actions []*tarianpb.Action var err error