From 05a5e46387f7f6af41158f0f58c2fb46654ecaf4 Mon Sep 17 00:00:00 2001 From: composer <2789706336@qq.com> Date: Tue, 13 Aug 2024 23:29:20 +0800 Subject: [PATCH] fix: mock for test --- exporter/dorisexporter/factory.go | 30 +++++++++++++++++-- .../internal/metadata/generated_status.go | 3 +- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/exporter/dorisexporter/factory.go b/exporter/dorisexporter/factory.go index 2b0020c861aa..a7793cd44fcc 100644 --- a/exporter/dorisexporter/factory.go +++ b/exporter/dorisexporter/factory.go @@ -11,6 +11,9 @@ import ( "go.opentelemetry.io/collector/config/configretry" "go.opentelemetry.io/collector/exporter" "go.opentelemetry.io/collector/exporter/exporterhelper" + "go.opentelemetry.io/collector/pdata/plog" + "go.opentelemetry.io/collector/pdata/pmetric" + "go.opentelemetry.io/collector/pdata/ptrace" "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/dorisexporter/internal/metadata" ) @@ -45,13 +48,34 @@ func createDefaultConfig() component.Config { } func createLogsExporter(ctx context.Context, set exporter.Settings, cfg component.Config) (exporter.Logs, error) { - return nil, nil + return exporterhelper.NewLogsExporter( + ctx, + set, + cfg, + func(ctx context.Context, ld plog.Logs) error { + return nil + }, + ) } func createTracesExporter(ctx context.Context, set exporter.Settings, cfg component.Config) (exporter.Traces, error) { - return nil, nil + return exporterhelper.NewTracesExporter( + ctx, + set, + cfg, + func(ctx context.Context, td ptrace.Traces) error { + return nil + }, + ) } func createMetricsExporter(ctx context.Context, set exporter.Settings, cfg component.Config) (exporter.Metrics, error) { - return nil, nil + return exporterhelper.NewMetricsExporter( + ctx, + set, + cfg, + func(ctx context.Context, md pmetric.Metrics) error { + return nil + }, + ) } diff --git a/exporter/dorisexporter/internal/metadata/generated_status.go b/exporter/dorisexporter/internal/metadata/generated_status.go index 2c6befbd7e87..57d6e7762b27 100644 --- a/exporter/dorisexporter/internal/metadata/generated_status.go +++ b/exporter/dorisexporter/internal/metadata/generated_status.go @@ -7,7 +7,8 @@ import ( ) var ( - Type = component.MustNewType("doris") + Type = component.MustNewType("doris") + ScopeName = "otelcol/doris" ) const (