-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Remove shared use of libhoney from goroutines. Fixes #272. #305
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
Remove shared use of libhoney from goroutines. Fixes #272. #305
Conversation
Codecov Report
@@ Coverage Diff @@
## master #305 +/- ##
==========================================
- Coverage 79.64% 79.64% -0.01%
==========================================
Files 163 163
Lines 8338 8337 -1
==========================================
- Hits 6641 6640 -1
Misses 1343 1343
Partials 354 354
Continue to review full report at Codecov.
|
I think the following might fix it at least partially: iff --git a/exporter/honeycombexporter/honeycomb.go b/exporter/honeycombexporter/honeycomb.go
index 338dfea..0a54538 100644
--- a/exporter/honeycombexporter/honeycomb.go
+++ b/exporter/honeycombexporter/honeycomb.go
@@ -20,6 +20,7 @@ import (
tracepb "github.com/census-instrumentation/opencensus-proto/gen-go/trace/v1"
libhoney "github.com/honeycombio/libhoney-go"
+ "github.com/honeycombio/libhoney-go/transmission"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/component/componenterror"
"go.opentelemetry.io/collector/consumer/consumerdata"
@@ -118,7 +119,7 @@ func (e *honeycombExporter) pushTraceData(ctx context.Context, td consumerdata.T
// Run the error logger. This just listens for messages in the error
// response queue and writes them out using the logger.
ctx, cancel := context.WithCancel(ctx)
- go e.RunErrorLogger(ctx)
+ go e.RunErrorLogger(ctx, libhoney.TxResponses())
defer cancel()
// Extract Node and Resource attributes, labels and other information.
@@ -289,8 +290,7 @@ func (e *honeycombExporter) Shutdown(context.Context) error {
//
// This method will block until the passed context.Context is canceled, or until
// exporter.Close is called.
-func (e *honeycombExporter) RunErrorLogger(ctx context.Context) {
- responses := libhoney.TxResponses()
+func (e *honeycombExporter) RunErrorLogger(ctx context.Context, responses chan transmission.Response) {
for {
select {
case r, ok := <-responses: |
I think basically you just need to avoid accessing any of the libhoney stuff from more than one goroutine and it should be fine. |
@keitwb I think you're right, and that's much easier than trying to protect |
There was a bug in a dependency causing non-deterministic test failures in the honeycomb exporter due to a data race. This change refactors RunErrorLogger to accept a channel instead of having to call methods on libhoney directly, reducing shared usage of libhoney from multiple goroutines. See #272 for details.
@paulosman where are we with this PR? I see more failures in the testhttps://app.circleci.com/pipelines/github/open-telemetry/opentelemetry-collector-contrib/1374/workflows/1392c193-e990-41f7-b418-51a80f488e1e/jobs/4182/steps |
This is ready to merge. |
@paulosman thanks! |
There was a bug in a dependency causing non-deterministic test failures in the honeycomb exporter due to a data race. This change refactors RunErrorLogger to accept a channel instead of having to call methods on libhoney directly, reducing shared usage of libhoney from multiple goroutines. See #272 for details.
Bumps [go.opentelemetry.io/collector](https://github.com/open-telemetry/opentelemetry-collector) from 0.38.0 to 0.39.0. - [Release notes](https://github.com/open-telemetry/opentelemetry-collector/releases) - [Changelog](https://github.com/open-telemetry/opentelemetry-collector/blob/main/CHANGELOG.md) - [Commits](open-telemetry/opentelemetry-collector@v0.38.0...v0.39.0) --- updated-dependencies: - dependency-name: go.opentelemetry.io/collector dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
There was a bug in a dependency causing non-deterministic test failures in the honeycomb exporter due to a data race. This change refactors RunErrorLogger to accept a channel instead of having to call methods on libhoney directly, reducing shared usage of libhoney from multiple goroutines.
See #272 for details.