Skip to content

Commit 342ca81

Browse files
authored
refactor: remove unused apm tracer (#17658)
apm tracer field is not used, remove it since we are moving to otel anyway
1 parent abd202a commit 342ca81

File tree

3 files changed

+4
-9
lines changed

3 files changed

+4
-9
lines changed

internal/beater/beater.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -892,7 +892,7 @@ func (s *Runner) newLibbeatFinalBatchProcessor(
892892
return nil, nil, fmt.Errorf("failed to create libbeat output pipeline: %w", err)
893893
}
894894
pipelineConnector := pipetool.WithACKer(pipeline, acker)
895-
publisher, err := publish.NewPublisher(pipelineConnector, tracer)
895+
publisher, err := publish.NewPublisher(pipelineConnector)
896896
if err != nil {
897897
return nil, nil, err
898898
}

internal/publish/pub.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import (
2525
"time"
2626

2727
"github.com/pkg/errors"
28-
"go.elastic.co/apm/v2"
2928
"go.elastic.co/fastjson"
3029

3130
"github.com/elastic/beats/v7/libbeat/beat"
@@ -47,7 +46,6 @@ type Reporter func(context.Context, PendingReq) error
4746
// concurrent HTTP requests trying to publish at the same time is limited.
4847
type Publisher struct {
4948
stopped chan struct{}
50-
tracer *apm.Tracer
5149
client beat.Client
5250

5351
mu sync.RWMutex
@@ -73,10 +71,9 @@ var (
7371
//
7472
// GOMAXPROCS goroutines are started for forwarding events to libbeat.
7573
// Stop must be called to close the beat.Client and free resources.
76-
func NewPublisher(pipeline beat.Pipeline, tracer *apm.Tracer) (*Publisher, error) {
74+
func NewPublisher(pipeline beat.Pipeline) (*Publisher, error) {
7775
processingCfg := beat.ProcessingConfig{}
7876
p := &Publisher{
79-
tracer: tracer,
8077
stopped: make(chan struct{}),
8178

8279
// One request will be actively processed by the

internal/publish/pub_test.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import (
3131
"github.com/stretchr/testify/assert"
3232
"github.com/stretchr/testify/require"
3333

34-
"go.elastic.co/apm/v2/apmtest"
3534
"go.elastic.co/fastjson"
3635

3736
"github.com/elastic/beats/v7/libbeat/beat"
@@ -54,7 +53,7 @@ func TestPublisherStop(t *testing.T) {
5453
// Create a pipeline with a limited queue size and no outputs,
5554
// so we can simulate a pipeline that blocks indefinitely.
5655
pipeline, client := newBlockingPipeline(t)
57-
publisher, err := publish.NewPublisher(pipeline, apmtest.DiscardTracer)
56+
publisher, err := publish.NewPublisher(pipeline)
5857
require.NoError(t, err)
5958
defer func() {
6059
cancelledContext, cancel := context.WithCancel(context.Background())
@@ -90,7 +89,7 @@ func TestPublisherStop(t *testing.T) {
9089

9190
func TestPublisherStopShutdownInactive(t *testing.T) {
9291
pipeline, _ := newBlockingPipeline(t)
93-
publisher, err := publish.NewPublisher(pipeline, apmtest.DiscardTracer)
92+
publisher, err := publish.NewPublisher(pipeline)
9493
require.NoError(t, err)
9594

9695
// There are no active events, so the publisher should stop immediately
@@ -192,7 +191,6 @@ func BenchmarkPublisher(b *testing.B) {
192191
acker.Open()
193192
publisher, err := publish.NewPublisher(
194193
pipetool.WithACKer(pipeline, acker),
195-
apmtest.DiscardTracer,
196194
)
197195
require.NoError(b, err)
198196

0 commit comments

Comments
 (0)