Skip to content

Commit

Permalink
[chore][receiver/cloudfoundry]: log error encountered while consuming (
Browse files Browse the repository at this point in the history
…open-telemetry#35641)

#### Description

Log errors encountered while calling `ConsumeLogs()` and
`ConsumeMetrics()`.
  • Loading branch information
VihasMakwana authored Oct 24, 2024
1 parent a41298f commit 0a753a7
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions receiver/cloudfoundryreceiver/receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"go.opentelemetry.io/collector/pdata/pmetric"
"go.opentelemetry.io/collector/receiver"
"go.opentelemetry.io/collector/receiver/receiverhelper"
"go.uber.org/zap"

"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/cloudfoundryreceiver/internal/metadata"
)
Expand Down Expand Up @@ -179,6 +180,9 @@ func (cfr *cloudFoundryReceiver) streamMetrics(
if libraryMetrics.Len() > 0 {
obsCtx := cfr.obsrecv.StartMetricsOp(ctx)
err := cfr.nextMetrics.ConsumeMetrics(ctx, metrics)
if err != nil {
cfr.settings.Logger.Error("Failed to consume metrics", zap.Error(err))
}
cfr.obsrecv.EndMetricsOp(obsCtx, dataFormat, metrics.DataPointCount(), err)
}
}
Expand Down Expand Up @@ -213,6 +217,9 @@ func (cfr *cloudFoundryReceiver) streamLogs(
if libraryLogs.Len() > 0 {
obsCtx := cfr.obsrecv.StartLogsOp(ctx)
err := cfr.nextLogs.ConsumeLogs(ctx, logs)
if err != nil {
cfr.settings.Logger.Error("Failed to consume logs", zap.Error(err))
}
cfr.obsrecv.EndLogsOp(obsCtx, dataFormat, logs.LogRecordCount(), err)
}
}
Expand Down

0 comments on commit 0a753a7

Please sign in to comment.