Skip to content

Commit 079c78c

Browse files
authored
[chore] Deprecate NewProfilesRequestExporter (#12811)
#12810 Signed-off-by: Israel Blancas <[email protected]>
1 parent e7bbf16 commit 079c78c

File tree

3 files changed

+18
-15
lines changed

3 files changed

+18
-15
lines changed

exporter/exporterhelper/internal/base_exporter.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ func WithCapabilities(capabilities consumer.Capabilities) Option {
232232
}
233233

234234
// WithBatcher enables batching for an exporter based on custom request types.
235-
// For now, it can be used only with the New[Traces|Metrics|Logs]RequestExporter exporter helpers and
235+
// For now, it can be used only with the New[Traces|Metrics|Logs|Profiles]Request exporter helpers and
236236
// WithRequestBatchFuncs provided.
237237
// This API is at the early stage of development and may change without backward compatibility
238238
// until https://github.com/open-telemetry/opentelemetry-collector/issues/8122 is resolved.

exporter/exporterhelper/xexporterhelper/profiles.go

+6-3
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ func NewProfilesExporter(
114114
if pusher == nil {
115115
return nil, errNilPushProfileData
116116
}
117-
return NewProfilesRequestExporter(ctx, set, requestFromProfiles(), requestConsumeFromProfiles(pusher),
117+
return NewProfilesRequest(ctx, set, requestFromProfiles(), requestConsumeFromProfiles(pusher),
118118
append([]exporterhelper.Option{internal.WithQueueBatchSettings(NewProfilesQueueBatchSettings())}, options...)...)
119119
}
120120

@@ -132,10 +132,13 @@ func requestFromProfiles() exporterhelper.RequestConverterFunc[pprofile.Profiles
132132
}
133133
}
134134

135-
// NewProfilesRequestExporter creates a new profiles exporter based on a custom ProfilesConverter and Sender.
135+
// Deprecated: [v0.124.0] use NewProfilesRequest.
136+
var NewProfilesRequestExporter = NewProfilesRequest
137+
138+
// NewProfilesRequest creates a new profiles exporter based on a custom ProfilesConverter and Sender.
136139
// Experimental: This API is at the early stage of development and may change without backward compatibility
137140
// until https://github.com/open-telemetry/opentelemetry-collector/issues/8122 is resolved.
138-
func NewProfilesRequestExporter(
141+
func NewProfilesRequest(
139142
_ context.Context,
140143
set exporter.Settings,
141144
converter exporterhelper.RequestConverterFunc[pprofile.Profiles],

exporter/exporterhelper/xexporterhelper/profiles_test.go

+11-11
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func TestProfilesExporter_NilLogger(t *testing.T) {
7070
}
7171

7272
func TestProfilesRequestExporter_NilLogger(t *testing.T) {
73-
le, err := NewProfilesRequestExporter(context.Background(), exporter.Settings{}, requestFromProfilesFunc(nil), sendertest.NewNopSenderFunc[exporterhelper.Request]())
73+
le, err := NewProfilesRequest(context.Background(), exporter.Settings{}, requestFromProfilesFunc(nil), sendertest.NewNopSenderFunc[exporterhelper.Request]())
7474
require.Nil(t, le)
7575
require.Equal(t, errNilLogger, err)
7676
}
@@ -82,13 +82,13 @@ func TestProfilesExporter_NilPushProfilesData(t *testing.T) {
8282
}
8383

8484
func TestProfilesExporter_NilTracesConverter(t *testing.T) {
85-
te, err := NewProfilesRequestExporter(context.Background(), exportertest.NewNopSettings(exportertest.NopType), nil, sendertest.NewNopSenderFunc[exporterhelper.Request]())
85+
te, err := NewProfilesRequest(context.Background(), exportertest.NewNopSettings(exportertest.NopType), nil, sendertest.NewNopSenderFunc[exporterhelper.Request]())
8686
require.Nil(t, te)
8787
require.Equal(t, errNilProfilesConverter, err)
8888
}
8989

9090
func TestProfilesRequestExporter_NilProfilesConverter(t *testing.T) {
91-
le, err := NewProfilesRequestExporter(context.Background(), exportertest.NewNopSettings(exportertest.NopType), requestFromProfilesFunc(nil), nil)
91+
le, err := NewProfilesRequest(context.Background(), exportertest.NewNopSettings(exportertest.NopType), requestFromProfilesFunc(nil), nil)
9292
require.Nil(t, le)
9393
require.Equal(t, errNilConsumeRequest, err)
9494
}
@@ -107,7 +107,7 @@ func TestProfilesExporter_Default(t *testing.T) {
107107

108108
func TestProfilesRequestExporter_Default(t *testing.T) {
109109
ld := pprofile.NewProfiles()
110-
le, err := NewProfilesRequestExporter(context.Background(), exportertest.NewNopSettings(exportertest.NopType),
110+
le, err := NewProfilesRequest(context.Background(), exportertest.NewNopSettings(exportertest.NopType),
111111
requestFromProfilesFunc(nil), sendertest.NewNopSenderFunc[exporterhelper.Request]())
112112
assert.NotNil(t, le)
113113
require.NoError(t, err)
@@ -129,7 +129,7 @@ func TestProfilesExporter_WithCapabilities(t *testing.T) {
129129

130130
func TestProfilesRequestExporter_WithCapabilities(t *testing.T) {
131131
capabilities := consumer.Capabilities{MutatesData: true}
132-
le, err := NewProfilesRequestExporter(context.Background(), exportertest.NewNopSettings(exportertest.NopType),
132+
le, err := NewProfilesRequest(context.Background(), exportertest.NewNopSettings(exportertest.NopType),
133133
requestFromProfilesFunc(nil), sendertest.NewNopSenderFunc[exporterhelper.Request](), exporterhelper.WithCapabilities(capabilities))
134134
require.NoError(t, err)
135135
require.NotNil(t, le)
@@ -149,7 +149,7 @@ func TestProfilesExporter_Default_ReturnError(t *testing.T) {
149149
func TestProfilesRequestExporter_Default_ConvertError(t *testing.T) {
150150
ld := pprofile.NewProfiles()
151151
want := errors.New("convert_error")
152-
le, err := NewProfilesRequestExporter(context.Background(), exportertest.NewNopSettings(exportertest.NopType),
152+
le, err := NewProfilesRequest(context.Background(), exportertest.NewNopSettings(exportertest.NopType),
153153
requestFromProfilesFunc(want), sendertest.NewNopSenderFunc[exporterhelper.Request]())
154154
require.NoError(t, err)
155155
require.NotNil(t, le)
@@ -159,7 +159,7 @@ func TestProfilesRequestExporter_Default_ConvertError(t *testing.T) {
159159
func TestProfilesRequestExporter_Default_ExportError(t *testing.T) {
160160
ld := pprofile.NewProfiles()
161161
want := errors.New("export_error")
162-
le, err := NewProfilesRequestExporter(context.Background(), exportertest.NewNopSettings(exportertest.NopType),
162+
le, err := NewProfilesRequest(context.Background(), exportertest.NewNopSettings(exportertest.NopType),
163163
requestFromProfilesFunc(nil), sendertest.NewErrSenderFunc[exporterhelper.Request](want))
164164
require.NoError(t, err)
165165
require.NotNil(t, le)
@@ -210,7 +210,7 @@ func TestProfilesRequestExporter_WithSpan(t *testing.T) {
210210
otel.SetTracerProvider(set.TracerProvider)
211211
defer otel.SetTracerProvider(nooptrace.NewTracerProvider())
212212

213-
le, err := NewProfilesRequestExporter(context.Background(), set, requestFromProfilesFunc(nil), sendertest.NewNopSenderFunc[exporterhelper.Request]())
213+
le, err := NewProfilesRequest(context.Background(), set, requestFromProfilesFunc(nil), sendertest.NewNopSenderFunc[exporterhelper.Request]())
214214
require.NoError(t, err)
215215
require.NotNil(t, le)
216216
checkWrapSpanForProfilesExporter(t, sr, set.TracerProvider.Tracer("test"), le, nil)
@@ -238,7 +238,7 @@ func TestProfilesRequestExporter_WithSpan_ReturnError(t *testing.T) {
238238
defer otel.SetTracerProvider(nooptrace.NewTracerProvider())
239239

240240
want := errors.New("my_error")
241-
le, err := NewProfilesRequestExporter(context.Background(), set, requestFromProfilesFunc(nil), sendertest.NewErrSenderFunc[exporterhelper.Request](want))
241+
le, err := NewProfilesRequest(context.Background(), set, requestFromProfilesFunc(nil), sendertest.NewErrSenderFunc[exporterhelper.Request](want))
242242
require.NoError(t, err)
243243
require.NotNil(t, le)
244244
checkWrapSpanForProfilesExporter(t, sr, set.TracerProvider.Tracer("test"), le, want)
@@ -260,7 +260,7 @@ func TestProfilesRequestExporter_WithShutdown(t *testing.T) {
260260
shutdownCalled := false
261261
shutdown := func(context.Context) error { shutdownCalled = true; return nil }
262262

263-
le, err := NewProfilesRequestExporter(context.Background(), exportertest.NewNopSettings(exportertest.NopType),
263+
le, err := NewProfilesRequest(context.Background(), exportertest.NewNopSettings(exportertest.NopType),
264264
requestFromProfilesFunc(nil), sendertest.NewNopSenderFunc[exporterhelper.Request](), exporterhelper.WithShutdown(shutdown))
265265
assert.NotNil(t, le)
266266
require.NoError(t, err)
@@ -284,7 +284,7 @@ func TestProfilesRequestExporter_WithShutdown_ReturnError(t *testing.T) {
284284
want := errors.New("my_error")
285285
shutdownErr := func(context.Context) error { return want }
286286

287-
le, err := NewProfilesRequestExporter(context.Background(), exportertest.NewNopSettings(exportertest.NopType),
287+
le, err := NewProfilesRequest(context.Background(), exportertest.NewNopSettings(exportertest.NopType),
288288
requestFromProfilesFunc(nil), sendertest.NewNopSenderFunc[exporterhelper.Request](), exporterhelper.WithShutdown(shutdownErr))
289289
assert.NotNil(t, le)
290290
require.NoError(t, err)

0 commit comments

Comments
 (0)