You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sqliteexporter/factory.go

48 lines
1.1 KiB

package sqliteexporter
import (
"context"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/consumer"
"go.opentelemetry.io/collector/exporter"
"go.opentelemetry.io/collector/exporter/exporterhelper"
"go.wperron.io/sqliteexporter/internal/metadata"
)
func NewFactory() exporter.Factory {
return exporter.NewFactory(
metadata.Type,
createDefaultConfig,
exporter.WithTraces(createTracesExporter, metadata.TracesStability),
exporter.WithMetrics(nil, metadata.MetricsStability),
exporter.WithLogs(nil, metadata.LogsStability),
)
}
func createDefaultConfig() component.Config {
return &Config{}
}
func createTracesExporter(
ctx context.Context,
set exporter.CreateSettings,
cfg component.Config,
) (exporter.Traces, error) {
conf := cfg.(*Config)
se := newSqliteExporter(conf)
return exporterhelper.NewTracesExporter(
ctx, set, cfg,
se.ConsumeTraces,
exporterhelper.WithStart(se.Start),
exporterhelper.WithShutdown(se.Shutdown),
exporterhelper.WithCapabilities(consumer.Capabilities{MutatesData: false}),
)
}
func newSqliteExporter(cfg *Config) *sqliteExporter {
return &sqliteExporter{}
}