Skip to content

Commit 5678708

Browse files
crobert-1mx-psi
authored andcommitted
[chore][cmd/configschema/docsgen/docsgen] Enable goleak (open-telemetry#30494)
**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.--> Enables `goleak` on the `docsgen` package to catch potential leaking goroutines. **Link to tracking Issue:** <Issue number if applicable> open-telemetry#30438 **Testing:** <Describe what testing was performed and which tests were added.> Test is passing other than referenced failure. --------- Co-authored-by: Pablo Baeyens <[email protected]>
1 parent 0c1b5ab commit 5678708

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Copyright The OpenTelemetry Authors
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
package docsgen
5+
6+
import (
7+
"testing"
8+
9+
"go.uber.org/goleak"
10+
)
11+
12+
// The Ignore function calls prevent catching leaks generated by indirect dependencies.
13+
// All of these are leaks that we can't fix from within the collector code base.
14+
// Regarding the OpenCensus ignore: see https://github.com/census-instrumentation/opencensus-go/issues/1191
15+
// Regarding the DataDog ignore: see https://github.com/DataDog/datadog-agent/issues/22030
16+
// Regarding the database/sql ignore: see https://github.com/SAP/go-hdb/issues/130
17+
// Regarding the SAP/go-hdb ignore: see https://github.com/SAP/go-hdb/issues/131
18+
// Regarding the cihub/seelog ignore: see https://github.com/cihub/seelog/issues/182
19+
// Regarding the godbus/dbus ignore: see https://github.com/99designs/keyring/issues/135
20+
func TestMain(m *testing.M) {
21+
goleak.VerifyTestMain(m,
22+
goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"),
23+
goleak.IgnoreTopFunction("github.com/DataDog/datadog-agent/pkg/trace/metrics/timing.(*Set).Autoreport.func1"),
24+
// Unfortunately this ignore can't be anymore specific, even though it's caused by the SAP/go-hdb/driver
25+
// package. There's no reference to this package in the goleak output. This has the potential of
26+
// hiding future leaks, so we should remove as soon as the referenced issue is resolved.
27+
goleak.IgnoreTopFunction("database/sql.(*DB).connectionOpener"),
28+
goleak.IgnoreTopFunction("github.com/SAP/go-hdb/driver.(*metrics).collect"),
29+
goleak.IgnoreAnyFunction("github.com/cihub/seelog.(*asyncLoopLogger).processQueue"),
30+
goleak.IgnoreAnyFunction("github.com/godbus/dbus.(*Conn).inWorker"))
31+
}

0 commit comments

Comments
 (0)