Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change obsreport receiver calling pattern in carbonreceiver #3443

Merged
merged 6 commits into from
May 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ The OpenTelemetry Collector Contrib contains everything in the [opentelemetry-co
- `groupbytrace` processor: Added workers for queue processing (#2902)
- `resourcedetection` processor: Add docker detector (#2775)
- `tailsampling` processor: Support regex on span attribute filtering (#3335_
- Change obsreport helpers for receiver to use the new pattern created in Collector (#3439,#3443)

## 🧰 Bug fixes 🧰

Expand Down
6 changes: 4 additions & 2 deletions receiver/carbonreceiver/reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ type reporter struct {
spanName string
logger *zap.Logger
sugaredLogger *zap.SugaredLogger // Used for generic debug logging
obsrecv *obsreport.Receiver
}

var _ transport.Reporter = (*reporter)(nil)
Expand All @@ -42,6 +43,7 @@ func newReporter(id config.ComponentID, logger *zap.Logger) transport.Reporter {
spanName: id.String() + ".receiver",
logger: logger,
sugaredLogger: logger.Sugar(),
obsrecv: obsreport.NewReceiver(obsreport.ReceiverSettings{ReceiverID: id, Transport: "tcp"}),
}
}

Expand All @@ -51,7 +53,7 @@ func newReporter(id config.ComponentID, logger *zap.Logger) transport.Reporter {
// returned span.
func (r *reporter) OnDataReceived(ctx context.Context) context.Context {
ctx = obsreport.ReceiverContext(ctx, r.id, "tcp")
return obsreport.StartMetricsReceiveOp(ctx, r.id, "tcp")
return r.obsrecv.StartMetricsReceiveOp(ctx)
}

// OnTranslationError is used to report a translation error from original
Expand Down Expand Up @@ -95,7 +97,7 @@ func (r *reporter) OnMetricsProcessed(
})
}

obsreport.EndMetricsReceiveOp(ctx, "carbon", numReceivedMetricPoints, err)
r.obsrecv.EndMetricsReceiveOp(ctx, "carbon", numReceivedMetricPoints, err)
}

func (r *reporter) OnDebugf(template string, args ...interface{}) {
Expand Down