Skip to content

Commit 1140d03

Browse files
committed
replace defer to t.cleanup
1 parent c42e1f7 commit 1140d03

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

exporters/otlp/otlplog/otlploggrpc/client_test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1184,7 +1184,9 @@ func BenchmarkExporterExportLogs(b *testing.B) {
11841184
run := func(b *testing.B) {
11851185
coll, err := newGRPCCollector("", nil)
11861186
require.NoError(b, err)
1187-
defer coll.srv.Stop()
1187+
b.Cleanup(func() {
1188+
coll.srv.Stop()
1189+
})
11881190

11891191
ctx := b.Context()
11901192
opts := []Option{
@@ -1194,6 +1196,9 @@ func BenchmarkExporterExportLogs(b *testing.B) {
11941196
}
11951197
exp, err := New(ctx, opts...)
11961198
require.NoError(b, err)
1199+
b.Cleanup(func() {
1200+
assert.NoError(b, exp.Shutdown(context.Background()))
1201+
})
11971202

11981203
logs := make([]log.Record, logRecordsCount)
11991204
now := time.Now()

exporters/otlp/otlplog/otlploggrpc/internal/observ/instrumentation.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func put[T any](p *sync.Pool, s *[]T) {
6868
}
6969

7070
// GetComponentName returns the constant name for the exporter with the
71-
// Provided id
71+
// provided id.
7272
func GetComponentName(id int64) string {
7373
return fmt.Sprintf("%s/%d", otelconv.ComponentTypeOtlpGRPCLogExporter, id)
7474
}

0 commit comments

Comments
 (0)