Skip to content

Commit

Permalink
[receiver/cloudfoundryreceiver] Improve error messages during initial…
Browse files Browse the repository at this point in the history
…ization

Co-authored-by: Cem Deniz Kabakci <cem.kabakci@springer.com>
  • Loading branch information
jriguera and CemDK committed May 30, 2024
1 parent ae1c749 commit 0bffb29
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions receiver/cloudfoundryreceiver/receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (cfr *cloudFoundryReceiver) Start(ctx context.Context, host component.Host)
string(cfr.config.UAA.Password),
)
if tokenErr != nil {
return fmt.Errorf("create cloud foundry UAA token provider: %w", tokenErr)
return fmt.Errorf("cloudfoundry receiver failed to create UAA token provider: %w", tokenErr)
}
streamFactory, streamErr := newEnvelopeStreamFactory(
ctx,
Expand All @@ -105,7 +105,7 @@ func (cfr *cloudFoundryReceiver) Start(ctx context.Context, host component.Host)
host,
)
if streamErr != nil {
return fmt.Errorf("creating cloud foundry RLP envelope stream factory: %w", streamErr)
return fmt.Errorf("cloudfoundry receiver failed to create RLP envelope stream factory: %w", streamErr)
}

innerCtx, cancel := context.WithCancel(ctx)
Expand All @@ -114,12 +114,12 @@ func (cfr *cloudFoundryReceiver) Start(ctx context.Context, host component.Host)

go func() {
defer cfr.goroutines.Done()
cfr.settings.Logger.Debug("cloud foundry receiver starting")
cfr.settings.Logger.Debug("cloudfoundry receiver starting")
_, tokenErr = tokenProvider.ProvideToken()
if tokenErr != nil {
cfr.settings.ReportStatus(
component.NewFatalErrorEvent(
fmt.Errorf("cloud foundry receiver failed to fetch initial token from UAA: %w", tokenErr),
fmt.Errorf("cloudfoundry receiver failed to fetch initial token from UAA: %w", tokenErr),
),
)
return
Expand All @@ -129,7 +129,7 @@ func (cfr *cloudFoundryReceiver) Start(ctx context.Context, host component.Host)
} else if cfr.nextMetrics != nil {
cfr.streamMetrics(innerCtx, streamFactory.CreateMetricsStream(innerCtx, cfr.config.RLPGateway.ShardID))
}
cfr.settings.Logger.Debug("cloudfoundry metrics streamer stopped")
cfr.settings.Logger.Debug("cloudfoundry receiver stopped")
}()
return nil
}
Expand Down

0 comments on commit 0bffb29

Please sign in to comment.