Skip to content

Commit

Permalink
Merge pull request #781 from juandspy/CCXDEV-14052
Browse files Browse the repository at this point in the history
[CCXDEV-14052] Remove formated error logs
  • Loading branch information
juandspy authored Aug 26, 2024
2 parents f1ba428 + d873638 commit b637391
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions differ/comparator.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (

// Messages
const (
clusterName = "cluster"
clusterStr = "cluster"
resolutionKey = "resolution"
resolutionMsg = "Should notify user"
resolutionReason = "reason"
Expand Down Expand Up @@ -116,7 +116,7 @@ func updateNotificationRecordSentState(storage Storage, cluster types.ClusterEnt
}

func updateNotificationRecordErrorState(storage Storage, err error, cluster types.ClusterEntry, report types.ClusterReport, notifiedAt types.Timestamp, eventTarget types.EventTarget) {
log.Error().Msgf("New issues couldn't be notified for cluster %s", string(cluster.ClusterName))
log.Error().Err(err).Str(clusterStr, string(cluster.ClusterName)).Msg("New issues couldn't be notified")
NotificationNotSentErrorState.Inc()
err = storage.WriteNotificationRecordForCluster(cluster, notificationTypes.Instant, states.ErrorState, report, notifiedAt, err.Error(), eventTarget)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions differ/content.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ func fetchAllRulesContent(config *conf.DependenciesConfiguration) (rules types.R

req, err := http.NewRequest("GET", contentURL, http.NoBody)
if err != nil {
log.Error().Msgf("Got error while setting up HTTP request for content service - %s", err.Error())
log.Error().Err(err).Msg("Got error while setting up HTTP request for content service")
return nil, err
}

body, err := httputils.SendRequest(req, 10*time.Second)
if err != nil {
log.Error().Msgf("Got error while processing HTTP request - %s", err.Error())
log.Error().Err(err).Msg("Got error while processing HTTP request")
return nil, err
}

Expand Down
3 changes: 1 addition & 2 deletions differ/renderer.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ func renderReportsForCluster(
clusterName types.ClusterName,
reports types.ReportContent,
ruleContent types.Rules) ([]types.RenderedReport, error) {

log.Debug().Str("cluster", string(clusterName)).Msg("RenderReportsForCluster")
log.Debug().Str(clusterStr, string(clusterName)).Msg("RenderReportsForCluster")

req, err := createTemplateRendererRequest(ruleContent, reports, clusterName, config.TemplateRendererURL)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion differ/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ func (storage DBStorage) WriteReadError(
if err != nil {
log.Err(err).
Int("org", int(orgID)).
Str("cluster", string(clusterName)).
Str(clusterStr, string(clusterName)).
Str("last checked", lastCheckedTime.String()).
Str("created at", createdAt.String()).
Str("error text", errorText).
Expand Down
4 changes: 2 additions & 2 deletions producer/servicelog/service_log_producer.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func (producer *Producer) ProduceMessage(msg types.ProducerMessage) (partitionID

response, err := client.Do(req)
if err != nil {
log.Error().Err(err).Msgf("Error making the HTTP request")
log.Error().Err(err).Msg("Error making the HTTP request")
return -1, -1, err
}

Expand Down Expand Up @@ -112,7 +112,7 @@ func (producer *Producer) ProduceMessage(msg types.ProducerMessage) (partitionID
return 0, 0, nil
default:
err = fmt.Errorf("received unexpected response status code - %s", response.Status)
log.Error().Err(err).Msgf("Got unexpected response status code")
log.Error().Err(err).Msg("Got unexpected response status code")
return -1, -1, err
}
}
Expand Down

0 comments on commit b637391

Please sign in to comment.