Skip to content

Commit

Permalink
less Error logs (#2040)
Browse files Browse the repository at this point in the history
  • Loading branch information
juandspy authored Aug 9, 2024
1 parent 7cc57e0 commit 6504b7e
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.20
require (
github.com/BurntSushi/toml v1.4.0
github.com/DATA-DOG/go-sqlmock v1.5.2
github.com/RedHatInsights/insights-operator-utils v1.25.5
github.com/RedHatInsights/insights-operator-utils v1.25.6
github.com/RedHatInsights/insights-results-aggregator-data v1.3.9
github.com/RedHatInsights/insights-results-types v1.23.4
github.com/Shopify/sarama v1.27.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ github.com/RedHatInsights/insights-operator-utils v1.21.0/go.mod h1:B2hizFGwXCc8
github.com/RedHatInsights/insights-operator-utils v1.21.2/go.mod h1:3Pfsgsi7GCu2wgIqQlt1llpyQyyxsDWEGdgnPvadM40=
github.com/RedHatInsights/insights-operator-utils v1.21.8/go.mod h1:qa1a8NdarIzcZkr5mu9fBw4OarOfg1qZFZC1vNGbyas=
github.com/RedHatInsights/insights-operator-utils v1.24.5/go.mod h1:7qR/8rlMdiqoXAkZyQ5JhVrVNCa6SBwNUt4KMq/17j4=
github.com/RedHatInsights/insights-operator-utils v1.25.5 h1:xyk4UAolH6vAzd+D6zKf6CoyDYsN4lx603qQhGXIxxA=
github.com/RedHatInsights/insights-operator-utils v1.25.5/go.mod h1:T9tCuJUXLThmmcg9sLkj+/ZMExsj7RFTmfyyHiHBCjQ=
github.com/RedHatInsights/insights-operator-utils v1.25.6 h1:r82W8JGO1UUVYwoS8Uy61ok/lO/iN2ljw55S/Rr4igY=
github.com/RedHatInsights/insights-operator-utils v1.25.6/go.mod h1:T9tCuJUXLThmmcg9sLkj+/ZMExsj7RFTmfyyHiHBCjQ=
github.com/RedHatInsights/insights-results-aggregator v0.0.0-20200604090056-3534f6dd9c1c/go.mod h1:7Pc15NYXErx7BMJ4rF1Hacm+29G6atzjhwBpXNFMt+0=
github.com/RedHatInsights/insights-results-aggregator-data v0.0.0-20200825113234-e84e924194bc/go.mod h1:DcDgoCCmBuUSKQOGrTi0BfFLdSjAp/KxIwyqKUd46sM=
github.com/RedHatInsights/insights-results-aggregator-data v0.0.0-20201014142608-de97c4b07d5c/go.mod h1:x8IvreR2g24veCKVMXDPOR6a0D86QK9UCBfi5Xm5Gnc=
Expand Down
6 changes: 3 additions & 3 deletions server/dvo_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func validateNamespaceID(namespace string) (string, error) {
if !IDValidator.MatchString(namespace) {
message := fmt.Sprintf("invalid namespace ID: '%s'", namespace)
err := errors.New(message)
log.Error().Err(err).Msg(message)
log.Warn().Err(err).Msg(message)
return "", err
}

Expand Down Expand Up @@ -136,7 +136,7 @@ func (server *HTTPServer) getWorkloads(writer http.ResponseWriter, request *http

workloads, err := server.StorageDvo.ReadWorkloadsForOrganization(orgID, clusterMap, request.Method == http.MethodPost)
if err != nil {
log.Error().Err(err).Msg("Errors retrieving DVO workload recommendations from storage")
log.Warn().Err(err).Msg("Errors retrieving DVO workload recommendations from storage")
handleServerError(writer, err)
return
}
Expand Down Expand Up @@ -286,7 +286,7 @@ func (server *HTTPServer) ProcessSingleDVONamespace(workload types.DVOReport) (
types.ErrorKey(recommendation.Key),
)
if err != nil {
log.Error().Err(err).Msg("error generating composite rule ID for rule")
log.Warn().Err(err).Msg("error generating composite rule ID for rule")
continue
}

Expand Down
6 changes: 3 additions & 3 deletions server/rating.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,23 @@ func (server *HTTPServer) setRuleRating(writer http.ResponseWriter, request *htt
// Split the rule_fqdn (RuleID) and ErrorKey from the received rule
ruleID, errorKey, err := getRuleAndErrorKeyFromRuleID(rating.Rule)
if err != nil {
log.Error().Err(err).Msg("Unable to parse rule identifier")
log.Warn().Err(err).Msg("Unable to parse rule identifier")
handleServerError(writer, err)
return
}

// Store to the db
err = server.Storage.RateOnRule(orgID, ruleID, errorKey, rating.Rating)
if err != nil {
log.Error().Err(err).Msg("Unable to store rating")
log.Warn().Err(err).Msg("Unable to store rating")
handleServerError(writer, err)
return
}

// If everythig goes fine, we should send the same ratings as response to the client
err = responses.SendOK(writer, responses.BuildOkResponseWithData("ratings", rating))
if err != nil {
log.Error().Err(err).Msg("Errors sending response back to client")
log.Warn().Err(err).Msg("Errors sending response back to client")
handleServerError(writer, err)
return
}
Expand Down
6 changes: 3 additions & 3 deletions server/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ func (server HTTPServer) getFeedbackAndTogglesOnRule(
) types.RuleOnReport {
ruleToggle, err := server.Storage.GetFromClusterRuleToggle(clusterName, rule.Module)
if err != nil {
log.Error().Err(err).Msg("Rule toggle was not found")
log.Warn().Err(err).Msg("Rule toggle was not found")
rule.Disabled = false
} else {
rule.Disabled = ruleToggle.Disabled == storage.RuleToggleDisable
Expand All @@ -351,7 +351,7 @@ func (server HTTPServer) getFeedbackAndTogglesOnRule(

disableFeedback, err := server.Storage.GetUserFeedbackOnRuleDisable(clusterName, rule.Module, rule.ErrorKey, userID)
if err != nil {
log.Error().Err(err).Msg("Feedback for rule was not found")
log.Warn().Err(err).Msg("Feedback for rule was not found")
rule.DisableFeedback = ""
} else {
log.Info().Msgf("feedback Message: '%v'", disableFeedback.Message)
Expand All @@ -360,7 +360,7 @@ func (server HTTPServer) getFeedbackAndTogglesOnRule(

userVote, err := server.Storage.GetUserFeedbackOnRule(clusterName, rule.Module, rule.ErrorKey, userID)
if err != nil {
log.Error().Err(err).Msg("User vote for rule was not found")
log.Warn().Err(err).Msg("User vote for rule was not found")
rule.UserVote = types.UserVoteNone
} else {
rule.UserVote = userVote.UserVote
Expand Down

0 comments on commit 6504b7e

Please sign in to comment.