Skip to content

Commit

Permalink
NO-JIRA: adjust loglevel for some further messages (#911)
Browse files Browse the repository at this point in the history
  • Loading branch information
tremes authored Feb 21, 2024
1 parent 014088a commit 4a8f083
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 25 deletions.
4 changes: 2 additions & 2 deletions pkg/config/configobserver/secretconfigobserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ func (c *Controller) setSecretConfig(operatorConfig *config.Controller) {
func (c *Controller) setConfig(operatorConfig *config.Controller) {
if c.config != nil {
if !reflect.DeepEqual(c.config, operatorConfig) {
klog.V(2).Infof("Legacy configuration updated: %s", operatorConfig.ToString())
klog.Infof("Legacy configuration updated: %s", operatorConfig.ToString())
for _, ch := range c.listeners {
if ch == nil {
continue
Expand All @@ -213,7 +213,7 @@ func (c *Controller) setConfig(operatorConfig *config.Controller) {
}
}
} else {
klog.V(2).Infof("Legacy configuration set: %s", operatorConfig.ToString())
klog.Infof("Legacy configuration set: %s", operatorConfig.ToString())
}
c.config = operatorConfig
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/config/legacy_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,6 @@ func LoadConfig(controller Controller, obj map[string]interface{}, converter Con
return controller, err
}
data, _ := json.Marshal(cfg)
klog.V(2).Infof("Current config: %s", string(data))
klog.Infof("Current config: %s", string(data))
return *loadedController, nil
}
4 changes: 2 additions & 2 deletions pkg/controller/status/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func (c *Controller) SetLastReportedTime(at time.Time) {
c.lock.Lock()
defer c.lock.Unlock()
if c.reported.LastReportTime.IsZero() {
klog.V(2).Infof("Initializing last reported time to %s", at.UTC().Format(time.RFC3339))
klog.Infof("Initializing last reported time to %s", at.UTC().Format(time.RFC3339))
}
c.reported.LastReportTime.Time = at
c.triggerStatusUpdate()
Expand Down Expand Up @@ -197,7 +197,7 @@ func (c *Controller) currentControllerStatus() (allReady bool) { //nolint: gocyc
for name, source := range c.Sources() {
summary, ready := source.CurrentStatus()
if !ready {
klog.V(4).Infof("Source %s %T is not ready", name, source)
klog.Infof("Source %s %T is not ready", name, source)
allReady = false
continue
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/controllerstatus/controllerstatus.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func (s *Simple) UpdateStatus(summary Summary) { //nolint: gocritic
}

if s.summary.Healthy != summary.Healthy {
klog.V(2).Infof("name=%s healthy=%t reason=%s message=%s", s.name, summary.Healthy, summary.Reason, summary.Message)
klog.Infof("name=%s healthy=%t reason=%s message=%s", s.name, summary.Healthy, summary.Reason, summary.Message)
s.summary = summary
s.summary.Count = 1
s.summary.LastTransitionTime = summary.LastTransitionTime
Expand All @@ -83,7 +83,7 @@ func (s *Simple) UpdateStatus(summary Summary) { //nolint: gocritic

s.summary.Count++
if s.summary.Message != summary.Message || s.summary.Reason != summary.Reason {
klog.V(2).Infof("name=%s healthy=%t reason=%s message=%s", s.name, summary.Healthy, summary.Reason, summary.Message)
klog.Infof("name=%s healthy=%t reason=%s message=%s", s.name, summary.Healthy, summary.Reason, summary.Message)
s.summary.Reason = summary.Reason
s.summary.Message = summary.Message
s.summary.Operation = summary.Operation
Expand Down
10 changes: 5 additions & 5 deletions pkg/insights/insightsclient/requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ func (c *Client) SendAndGetID(ctx context.Context, endpoint string, source Sourc
insights.IncrementCounterRequestSend(resp.StatusCode)

if resp.StatusCode == http.StatusUnauthorized {
klog.V(2).Infof("gateway server %s returned 401, %s=%s", resp.Request.URL, insightsReqId, requestID)
klog.Infof("gateway server %s returned 401, %s=%s", resp.Request.URL, insightsReqId, requestID)
return "", resp.StatusCode, authorizer.Error{Err: fmt.Errorf("your Red Hat account is not enabled for remote support or your token has expired: %s", responseBody(resp))}
}

if resp.StatusCode == http.StatusForbidden {
klog.V(2).Infof("gateway server %s returned 403, %s=%s", resp.Request.URL, insightsReqId, requestID)
klog.Infof("gateway server %s returned 403, %s=%s", resp.Request.URL, insightsReqId, requestID)
return "", resp.StatusCode, authorizer.Error{Err: fmt.Errorf("your Red Hat account is not enabled for remote support")}
}

Expand All @@ -85,7 +85,7 @@ func (c *Client) SendAndGetID(ctx context.Context, endpoint string, source Sourc
}

if len(requestID) > 0 {
klog.V(2).Infof("Successfully reported id=%s %s=%s, wrote=%d", source.ID, insightsReqId, requestID, <-bytesRead)
klog.Infof("Successfully reported id=%s %s=%s, wrote=%d", source.ID, insightsReqId, requestID, <-bytesRead)
}

return requestID, resp.StatusCode, nil
Expand Down Expand Up @@ -131,13 +131,13 @@ func (c *Client) RecvReport(ctx context.Context, endpoint string) (*http.Respons
requestID := resp.Header.Get("x-rh-insights-request-id")

if resp.StatusCode == http.StatusUnauthorized {
klog.V(2).Infof("gateway server %s returned 401, x-rh-insights-request-id=%s", resp.Request.URL, requestID)
klog.Infof("gateway server %s returned 401, x-rh-insights-request-id=%s", resp.Request.URL, requestID)
c.IncrementRecvReportMetric(resp.StatusCode)
return nil, authorizer.Error{Err: fmt.Errorf("your Red Hat account is not enabled for remote support or your token has expired")}
}

if resp.StatusCode == http.StatusForbidden {
klog.V(2).Infof("gateway server %s returned 403, x-rh-insights-request-id=%s", resp.Request.URL, requestID)
klog.Infof("gateway server %s returned 403, x-rh-insights-request-id=%s", resp.Request.URL, requestID)
c.IncrementRecvReportMetric(resp.StatusCode)
return nil, authorizer.Error{Err: fmt.Errorf("your Red Hat account is not enabled for remote support")}
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/insights/insightsreport/insightsreport.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,9 @@ func (c *Controller) RetrieveReport() {
// Run goroutine code for gathering the reports from Smart Proxy
func (c *Controller) Run(ctx context.Context) {
c.StatusController.UpdateStatus(controllerstatus.Summary{Healthy: true})
klog.V(2).Info("Starting report retriever")
klog.Info("Starting report retriever")
conf := c.configurator.Config()
klog.V(2).Infof("Insights analysis reports will be downloaded from the %s endpoint with a delay of %s",
klog.Infof("Insights analysis reports will be downloaded from the %s endpoint with a delay of %s",
conf.DataReporting.DownloadEndpoint, conf.DataReporting.ReportPullingDelay)
for {
// always wait for new uploaded archive or insights-operator ends
Expand Down
15 changes: 6 additions & 9 deletions pkg/insights/insightsuploader/insightsuploader.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func (c *Controller) Run(ctx context.Context) {
c.initialDelay = wait.Jitter(next.Sub(now), 1.2)
}
}
klog.V(2).Infof("Reporting status periodically to %s every %s, starting in %s", cfg.DataReporting.UploadEndpoint, interval, c.initialDelay.Truncate(time.Second))
klog.Infof("Reporting status periodically to %s every %s, starting in %s", cfg.DataReporting.UploadEndpoint, interval, c.initialDelay.Truncate(time.Second))
go wait.Until(func() { c.periodicTrigger(ctx.Done()) }, 5*time.Second, ctx.Done())
}

Expand Down Expand Up @@ -129,7 +129,7 @@ func (c *Controller) periodicTrigger(stopCh <-chan struct{}) {
disabledInAPI = c.apiConfigurator.GatherDisabled()
}
if !reportingEnabled || disabledInAPI {
klog.V(2).Infof("Reporting was disabled")
klog.Infof("Reporting was disabled")
c.initialDelay = newCfg.DataReporting.Interval
return
}
Expand Down Expand Up @@ -168,7 +168,7 @@ func (c *Controller) checkSummaryAndSend(interval time.Duration, lastReported ti
source.ID = id
source.Type = "application/vnd.redhat.openshift.periodic"
if err := c.client.Send(ctx, endpoint, *source); err != nil {
klog.V(2).Infof("Unable to upload report after %s: %v", time.Since(start).Truncate(time.Second/100), err)
klog.Infof("Unable to upload report after %s: %v", time.Since(start).Truncate(time.Second/100), err)
if errors.Is(err, insightsclient.ErrWaitingForVersion) {
c.initialDelay = wait.Jitter(time.Second*15, 1)
return
Expand Down Expand Up @@ -196,7 +196,7 @@ func (c *Controller) checkSummaryAndSend(interval time.Duration, lastReported ti
} else {
klog.Info("Display report that would be sent")
// display what would have been sent (to ensure we always exercise source processing)
if err := reportToLogs(source.Contents, klog.V(2)); err != nil {
if err := reportToLogs(source.Contents); err != nil {
klog.Errorf("Unable to log upload: %v", err)
}
// we didn't actually report logs, so don't advance the report date
Expand Down Expand Up @@ -225,7 +225,7 @@ func (c *Controller) Upload(ctx context.Context, s *insightsclient.Source) (stri
if err != nil {
// do no return the error if it's not the last attempt
if c.backoff.Steps > 1 {
klog.V(2).Infof("Unable to upload report after %s: %v", time.Since(start).Truncate(time.Second/100), err)
klog.Infof("Unable to upload report after %s: %v", time.Since(start).Truncate(time.Second/100), err)
klog.Errorf("%v. Trying again in %s", err, c.backoff.Step())
return false, nil
}
Expand All @@ -239,10 +239,7 @@ func (c *Controller) Upload(ctx context.Context, s *insightsclient.Source) (stri
return requestID, statusCode, nil
}

func reportToLogs(source io.Reader, klog klog.Verbose) error {
if !klog.Enabled() {
return nil
}
func reportToLogs(source io.Reader) error {
gr, err := gzip.NewReader(source)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion pkg/recorder/diskrecorder/diskrecorder.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (d *DiskRecorder) SaveAtPath(records record.MemoryRecords, path string) (re
start := time.Now()
defer func() {
if wrote > 0 {
klog.V(2).Infof("Wrote %d records to disk in %s", wrote, time.Since(start).Truncate(time.Millisecond))
klog.Infof("Wrote %d records to disk in %s", wrote, time.Since(start).Truncate(time.Millisecond))
}
}()

Expand Down
2 changes: 1 addition & 1 deletion pkg/recorder/recorder.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ func (r *Recorder) PeriodicallyPrune(ctx context.Context, reported alreadyReport
wait.Until(func() {
basePruneInterval := r.interval * 2
interval := wait.Jitter(basePruneInterval, 1.2)
klog.V(2).Infof("Pruning old reports every %s, max age is %s", interval.Truncate(time.Second), r.maxAge)
klog.Infof("Pruning old reports every %s, max age is %s", interval.Truncate(time.Second), r.maxAge)
timer := time.NewTicker(interval)
defer timer.Stop()
for {
Expand Down

0 comments on commit 4a8f083

Please sign in to comment.