Skip to content

Commit 7552cad

Browse files
authored
[chore][exporter/fileexporter] Enable goleak check (#30899)
**Description:** <Describe what has changed.> <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> This enables `goleak` to check for any leaking goroutines in this package. There is an existing goleak, but it's in a third party dependency which we cannot resolve on our end. There's been a [PR open for this issue](natefinch/lumberjack#57) for 6 years and it hasn't been merged. **Note:** The `natefinch/lumberjack` package is now unmaintained, so this will likely never be fixed. We should consider moving to a new package if possible to avoid the leak. I'll defer to code owners for feedback on possible options. **Link to tracking Issue:** <Issue number if applicable> #30438 **Testing:** <Describe what testing was performed and which tests were added.> Existing tests and added goleak check are passing.
1 parent 9ea8a56 commit 7552cad

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

exporter/fileexporter/go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ require (
1414
go.opentelemetry.io/collector/pdata v1.0.2-0.20240130181942-9c7177496fd5
1515
go.opentelemetry.io/otel/metric v1.22.0
1616
go.opentelemetry.io/otel/trace v1.22.0
17+
go.uber.org/goleak v1.3.0
1718
gopkg.in/natefinch/lumberjack.v2 v2.2.1
1819
)
1920

exporter/fileexporter/go.sum

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

exporter/fileexporter/package_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright The OpenTelemetry Authors
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
package fileexporter
5+
6+
import (
7+
"testing"
8+
9+
"go.uber.org/goleak"
10+
)
11+
12+
// The IgnoreTopFunction call prevents catching the leak generated by the natefinch/lumberjack package.
13+
// Existing issue for leak: https://github.com/natefinch/lumberjack/issues/56
14+
func TestMain(m *testing.M) {
15+
goleak.VerifyTestMain(m, goleak.IgnoreTopFunction("gopkg.in/natefinch/lumberjack%2ev2.(*Logger).millRun"))
16+
}

0 commit comments

Comments
 (0)