Skip to content

File tree

8 files changed

+11
-86
lines changed

8 files changed

+11
-86
lines changed

.chloggen/goleak_signalfx_correlations.yaml

Lines changed: 0 additions & 27 deletions
This file was deleted.

exporter/signalfxexporter/internal/apm/correlations/client.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ type CorrelationClient interface {
4444
Delete(*Correlation, SuccessfulDeleteCB)
4545
Get(dimName string, dimValue string, cb SuccessfulGetCB)
4646
Start()
47-
Shutdown()
4847
}
4948

5049
type request struct {
@@ -388,9 +387,3 @@ func (cc *Client) Start() {
388387
go cc.processChan()
389388
go cc.processRetryChan()
390389
}
391-
392-
// Shutdown the client. This will block until the context's cancel
393-
// function is complete.
394-
func (cc *Client) Shutdown() {
395-
cc.wg.Wait()
396-
}

exporter/signalfxexporter/internal/apm/correlations/client_test.go

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,18 @@ func makeHandler(t *testing.T, corCh chan<- *request, forcedRespCode *atomic.Val
124124
})
125125
}
126126

127-
func setup(t *testing.T) (CorrelationClient, *httptest.Server, chan *request, *atomic.Value, *atomic.Value, context.CancelFunc, context.Context) {
127+
func setup(t *testing.T) (CorrelationClient, chan *request, *atomic.Value, *atomic.Value, context.CancelFunc) {
128128
serverCh := make(chan *request, 100)
129129

130130
var forcedRespCode atomic.Value
131131
var forcedRespPayload atomic.Value
132132
server := httptest.NewServer(makeHandler(t, serverCh, &forcedRespCode, &forcedRespPayload))
133133

134134
ctx, cancel := context.WithCancel(context.Background())
135+
go func() {
136+
<-ctx.Done()
137+
server.Close()
138+
}()
135139

136140
serverURL, err := url.Parse(server.URL)
137141
if err != nil {
@@ -172,20 +176,13 @@ func setup(t *testing.T) (CorrelationClient, *httptest.Server, chan *request, *a
172176
}
173177
client.Start()
174178

175-
return client, server, serverCh, &forcedRespCode, &forcedRespPayload, cancel, ctx
176-
}
177-
178-
func teardown(ctx context.Context, client CorrelationClient, server *httptest.Server, serverCh chan *request, cancel context.CancelFunc) {
179-
close(serverCh)
180-
cancel()
181-
<-ctx.Done()
182-
client.Shutdown()
183-
server.Close()
179+
return client, serverCh, &forcedRespCode, &forcedRespPayload, cancel
184180
}
185181

186182
func TestCorrelationClient(t *testing.T) {
187-
client, server, serverCh, forcedRespCode, forcedRespPayload, cancel, ctx := setup(t)
188-
defer teardown(ctx, client, server, serverCh, cancel)
183+
client, serverCh, forcedRespCode, forcedRespPayload, cancel := setup(t)
184+
defer close(serverCh)
185+
defer cancel()
189186

190187
for _, correlationType := range []Type{Service, Environment} {
191188
for _, op := range []string{http.MethodPut, http.MethodDelete} {
@@ -245,7 +242,7 @@ func TestCorrelationClient(t *testing.T) {
245242
client.Correlate(testData, CorrelateCB(func(_ *Correlation, _ error) {}))
246243
// sending the testData twice tests deduplication, since the 500 status
247244
// will trigger retries, and the requests should be deduped and the
248-
// TotalRetriedUpdates should still only be 5
245+
// TotalRertriedUpdates should still only be 5
249246
client.Correlate(testData, CorrelateCB(func(_ *Correlation, _ error) {}))
250247

251248
cors := waitForCors(serverCh, 1, 4)

exporter/signalfxexporter/internal/apm/correlations/package_test.go

Lines changed: 0 additions & 17 deletions
This file was deleted.

exporter/signalfxexporter/internal/apm/tracetracker/tracker_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,7 @@ type correlationTestClient struct {
8585
correlateCounter int64
8686
}
8787

88-
func (c *correlationTestClient) Start() { /*no-op*/ }
89-
func (c *correlationTestClient) Shutdown() { /*no-op*/ }
88+
func (c *correlationTestClient) Start() { /*no-op*/ }
9089
func (c *correlationTestClient) Get(_ string, dimValue string, cb correlations.SuccessfulGetCB) {
9190
atomic.AddInt64(&c.getCounter, 1)
9291
go func() {

exporter/signalfxexporter/internal/correlation/correlation.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ func (cor *Tracker) Shutdown(_ context.Context) error {
137137
if cor != nil {
138138
if cor.correlation != nil {
139139
cor.correlation.cancel()
140-
cor.correlation.CorrelationClient.Shutdown()
141140
}
142141

143142
if cor.pTicker != nil {

exporter/signalfxexporter/internal/correlation/correlation_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ func TestTrackerStart(t *testing.T) {
8686
} else {
8787
require.NoError(t, err)
8888
}
89-
90-
assert.NoError(t, tracker.Shutdown(context.Background()))
9189
})
9290
}
9391
}

exporter/signalfxexporter/internal/correlation/package_test.go

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)