From a447f5c2139599125f43d2cc703795e7df57ee58 Mon Sep 17 00:00:00 2001 From: Curtis Robert Date: Fri, 19 Apr 2024 15:38:07 -0700 Subject: [PATCH 1/5] [chore][processor/groupbytrace] Enable goleak check --- processor/groupbytraceprocessor/go.mod | 1 + .../groupbytraceprocessor/package_test.go | 21 +++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 processor/groupbytraceprocessor/package_test.go diff --git a/processor/groupbytraceprocessor/go.mod b/processor/groupbytraceprocessor/go.mod index 10265666c39b..469dbc205df1 100644 --- a/processor/groupbytraceprocessor/go.mod +++ b/processor/groupbytraceprocessor/go.mod @@ -13,6 +13,7 @@ require ( go.opentelemetry.io/collector/processor v0.98.1-0.20240416174005-d0f15e2463f8 go.opentelemetry.io/otel/metric v1.25.0 go.opentelemetry.io/otel/trace v1.25.0 + go.uber.org/goleak v1.3.0 go.uber.org/multierr v1.11.0 go.uber.org/zap v1.27.0 ) diff --git a/processor/groupbytraceprocessor/package_test.go b/processor/groupbytraceprocessor/package_test.go new file mode 100644 index 000000000000..121ae44febde --- /dev/null +++ b/processor/groupbytraceprocessor/package_test.go @@ -0,0 +1,21 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package groupbytraceprocessor + +import ( + "testing" + + "go.uber.org/goleak" +) + +// The IgnoreTopFunction call prevents catching the leak generated by opencensus +// defaultWorker.Start which at this time is part of the package's init call. +// See https://github.com/census-instrumentation/opencensus-go/issues/1191 for more information. +// TODO: Regarding doWithTimeout ignore: https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/32572 +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m, + goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), + goleak.IgnoreAnyFunction("github.com/open-telemetry/opentelemetry-collector-contrib/processor/groupbytraceprocessor.doWithTimeout.func1"), + ) +} From e1540dee0dcbb2ae11d2fe605206aed343562179 Mon Sep 17 00:00:00 2001 From: Curtis Robert Date: Mon, 22 Apr 2024 14:24:30 -0700 Subject: [PATCH 2/5] Move goleak test to generated file --- .../groupbytraceprocessor/package_test.go | 21 ------------------- .../generated_package_test.go | 4 +++- processor/remotetapprocessor/metadata.yaml | 7 ++++++- 3 files changed, 9 insertions(+), 23 deletions(-) delete mode 100644 processor/groupbytraceprocessor/package_test.go diff --git a/processor/groupbytraceprocessor/package_test.go b/processor/groupbytraceprocessor/package_test.go deleted file mode 100644 index 121ae44febde..000000000000 --- a/processor/groupbytraceprocessor/package_test.go +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package groupbytraceprocessor - -import ( - "testing" - - "go.uber.org/goleak" -) - -// The IgnoreTopFunction call prevents catching the leak generated by opencensus -// defaultWorker.Start which at this time is part of the package's init call. -// See https://github.com/census-instrumentation/opencensus-go/issues/1191 for more information. -// TODO: Regarding doWithTimeout ignore: https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/32572 -func TestMain(m *testing.M) { - goleak.VerifyTestMain(m, - goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), - goleak.IgnoreAnyFunction("github.com/open-telemetry/opentelemetry-collector-contrib/processor/groupbytraceprocessor.doWithTimeout.func1"), - ) -} diff --git a/processor/remotetapprocessor/generated_package_test.go b/processor/remotetapprocessor/generated_package_test.go index 673077d15f09..24970a1ee1a0 100644 --- a/processor/remotetapprocessor/generated_package_test.go +++ b/processor/remotetapprocessor/generated_package_test.go @@ -4,8 +4,10 @@ package remotetapprocessor import ( "testing" + + "go.uber.org/goleak" ) func TestMain(m *testing.M) { - // skipping goleak test as per metadata.yml configuration + goleak.VerifyTestMain(m, goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), goleak.IgnoreAnyFunction("github.com/open-telemetry/opentelemetry-collector-contrib/processor/groupbytraceprocessor.doWithTimeout.func1")) } diff --git a/processor/remotetapprocessor/metadata.yaml b/processor/remotetapprocessor/metadata.yaml index 1488c43eca59..0a89395c7494 100644 --- a/processor/remotetapprocessor/metadata.yaml +++ b/processor/remotetapprocessor/metadata.yaml @@ -13,4 +13,9 @@ status: tests: config: goleak: - skip: true + skip: false + ignore: + # See https://github.com/census-instrumentation/opencensus-go/issues/1191 for more information. + top: go.opencensus.io/stats/view.(*worker).start + # TODO: Regarding doWithTimeout ignore: https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/32572 + any: github.com/open-telemetry/opentelemetry-collector-contrib/processor/groupbytraceprocessor.doWithTimeout.func1 From 43ebb055779350a98ad6dd922c30f25830899eff Mon Sep 17 00:00:00 2001 From: Curtis Robert Date: Mon, 22 Apr 2024 14:46:39 -0700 Subject: [PATCH 3/5] Remote remotetap, add groupbytrace --- processor/groupbytraceprocessor/generated_package_test.go | 4 +++- processor/groupbytraceprocessor/metadata.yaml | 8 +++++++- processor/remotetapprocessor/generated_package_test.go | 4 +--- processor/remotetapprocessor/metadata.yaml | 7 +------ 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/processor/groupbytraceprocessor/generated_package_test.go b/processor/groupbytraceprocessor/generated_package_test.go index 401bb12715a4..c43485899052 100644 --- a/processor/groupbytraceprocessor/generated_package_test.go +++ b/processor/groupbytraceprocessor/generated_package_test.go @@ -4,8 +4,10 @@ package groupbytraceprocessor import ( "testing" + + "go.uber.org/goleak" ) func TestMain(m *testing.M) { - // skipping goleak test as per metadata.yml configuration + goleak.VerifyTestMain(m, goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), goleak.IgnoreAnyFunction("github.com/open-telemetry/opentelemetry-collector-contrib/processor/groupbytraceprocessor.doWithTimeout.func1")) } diff --git a/processor/groupbytraceprocessor/metadata.yaml b/processor/groupbytraceprocessor/metadata.yaml index 037963826eb1..db58ac3c2b85 100644 --- a/processor/groupbytraceprocessor/metadata.yaml +++ b/processor/groupbytraceprocessor/metadata.yaml @@ -12,4 +12,10 @@ status: tests: config: goleak: - skip: true + skip: false + ignore: + # See https://github.com/census-instrumentation/opencensus-go/issues/1191 for more information. + top: go.opencensus.io/stats/view.(*worker).start + # TODO: Regarding doWithTimeout ignore: https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/32572 + any: github.com/open-telemetry/opentelemetry-collector-contrib/processor/groupbytraceprocessor.doWithTimeout.func1 + diff --git a/processor/remotetapprocessor/generated_package_test.go b/processor/remotetapprocessor/generated_package_test.go index 24970a1ee1a0..673077d15f09 100644 --- a/processor/remotetapprocessor/generated_package_test.go +++ b/processor/remotetapprocessor/generated_package_test.go @@ -4,10 +4,8 @@ package remotetapprocessor import ( "testing" - - "go.uber.org/goleak" ) func TestMain(m *testing.M) { - goleak.VerifyTestMain(m, goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), goleak.IgnoreAnyFunction("github.com/open-telemetry/opentelemetry-collector-contrib/processor/groupbytraceprocessor.doWithTimeout.func1")) + // skipping goleak test as per metadata.yml configuration } diff --git a/processor/remotetapprocessor/metadata.yaml b/processor/remotetapprocessor/metadata.yaml index 0a89395c7494..a9113f730749 100644 --- a/processor/remotetapprocessor/metadata.yaml +++ b/processor/remotetapprocessor/metadata.yaml @@ -13,9 +13,4 @@ status: tests: config: goleak: - skip: false - ignore: - # See https://github.com/census-instrumentation/opencensus-go/issues/1191 for more information. - top: go.opencensus.io/stats/view.(*worker).start - # TODO: Regarding doWithTimeout ignore: https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/32572 - any: github.com/open-telemetry/opentelemetry-collector-contrib/processor/groupbytraceprocessor.doWithTimeout.func1 + skip: true \ No newline at end of file From 7cec382bbcc20bd26400fc373d7f1e52300545d4 Mon Sep 17 00:00:00 2001 From: Curtis Robert Date: Mon, 22 Apr 2024 14:47:36 -0700 Subject: [PATCH 4/5] Remove deleted empty line --- processor/remotetapprocessor/metadata.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/processor/remotetapprocessor/metadata.yaml b/processor/remotetapprocessor/metadata.yaml index a9113f730749..1488c43eca59 100644 --- a/processor/remotetapprocessor/metadata.yaml +++ b/processor/remotetapprocessor/metadata.yaml @@ -13,4 +13,4 @@ status: tests: config: goleak: - skip: true \ No newline at end of file + skip: true From 39f6b84fb4790a052b921274944658387a013c8d Mon Sep 17 00:00:00 2001 From: Alex Boten <223565+codeboten@users.noreply.github.com> Date: Tue, 23 Apr 2024 12:15:19 -0700 Subject: [PATCH 5/5] Update processor/groupbytraceprocessor/metadata.yaml --- processor/groupbytraceprocessor/metadata.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/processor/groupbytraceprocessor/metadata.yaml b/processor/groupbytraceprocessor/metadata.yaml index db58ac3c2b85..64bc82d3f13c 100644 --- a/processor/groupbytraceprocessor/metadata.yaml +++ b/processor/groupbytraceprocessor/metadata.yaml @@ -12,7 +12,6 @@ status: tests: config: goleak: - skip: false ignore: # See https://github.com/census-instrumentation/opencensus-go/issues/1191 for more information. top: go.opencensus.io/stats/view.(*worker).start