Skip to content

Commit

Permalink
Change obsreport receiver calling pattern in carbonreceiver (#3443)
Browse files Browse the repository at this point in the history
* Make changes to awsxrayreceiver

* Make changes to carbonreceiver

* Add entry to changelog
  • Loading branch information
humivo authored May 21, 2021
1 parent 8bb714e commit 2e21d93
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
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

0 comments on commit 2e21d93

Please sign in to comment.