@@ -20,6 +20,7 @@ import (
20
20
"go.opentelemetry.io/collector/component"
21
21
"go.opentelemetry.io/collector/config/configgrpc"
22
22
"go.opentelemetry.io/collector/config/configmodels"
23
+ "go.opentelemetry.io/collector/exporter/exporterhelper"
23
24
)
24
25
25
26
const (
@@ -57,23 +58,61 @@ func (f *Factory) CreateTraceExporter(
57
58
params component.ExporterCreateParams ,
58
59
cfg configmodels.Exporter ,
59
60
) (component.TraceExporter , error ) {
60
- return NewTraceExporter (ctx , params , cfg )
61
+ oce , err := newExporter (cfg )
62
+ if err != nil {
63
+ return nil , err
64
+ }
65
+ oexp , err := exporterhelper .NewTraceExporter (
66
+ cfg ,
67
+ oce .pushTraceData ,
68
+ exporterhelper .WithShutdown (oce .shutdown ))
69
+ if err != nil {
70
+ return nil , err
71
+ }
72
+
73
+ return oexp , nil
61
74
}
62
75
63
76
// CreateMetricsExporter creates a metrics exporter based on this config.
64
77
func (f * Factory ) CreateMetricsExporter (
65
- ctx context.Context ,
66
- params component.ExporterCreateParams ,
78
+ _ context.Context ,
79
+ _ component.ExporterCreateParams ,
67
80
cfg configmodels.Exporter ,
68
81
) (component.MetricsExporter , error ) {
69
- return NewMetricsExporter (ctx , params , cfg )
82
+ oce , err := newExporter (cfg )
83
+ if err != nil {
84
+ return nil , err
85
+ }
86
+ oexp , err := exporterhelper .NewMetricsExporter (
87
+ cfg ,
88
+ oce .pushMetricsData ,
89
+ exporterhelper .WithShutdown (oce .shutdown ),
90
+ )
91
+ if err != nil {
92
+ return nil , err
93
+ }
94
+
95
+ return oexp , nil
70
96
}
71
97
72
98
// CreateLogExporter creates a log exporter based on this config.
73
99
func (f * Factory ) CreateLogExporter (
74
- ctx context.Context ,
75
- params component.ExporterCreateParams ,
100
+ _ context.Context ,
101
+ _ component.ExporterCreateParams ,
76
102
cfg configmodels.Exporter ,
77
103
) (component.LogExporter , error ) {
78
- return NewLogExporter (ctx , params , cfg )
104
+ oce , err := newExporter (cfg )
105
+ if err != nil {
106
+ return nil , err
107
+ }
108
+ oexp , err := exporterhelper .NewLogsExporter (
109
+ cfg ,
110
+ oce .pushLogData ,
111
+ exporterhelper .WithShutdown (oce .shutdown ),
112
+ )
113
+ if err != nil {
114
+ return nil , err
115
+ }
116
+
117
+ return oexp , nil
79
118
}
0 commit comments