package combined_exporter import ( "context" "fmt" "go.opentelemetry.io/otel/sdk/trace" ) type Exporter struct { exporters []trace.SpanExporter } func NewExporter(exporters ...trace.SpanExporter) trace.SpanExporter { return &Exporter{ exporters: exporters, } } // Implements [trace.SpanExporter] func (e *Exporter) ExportSpans(ctx context.Context, spans []trace.ReadOnlySpan) error { for _, exp := range e.exporters { exp.ExportSpans(ctx, spans) } return nil } // Implements [trace.SpanExporter] func (e *Exporter) Shutdown(ctx context.Context) error { var errs []error for _, exp := range e.exporters { err := exp.Shutdown(ctx) if err != nil { errs = append(errs, err) } } if len(errs) > 0 { return fmt.Errorf("multiple erros have occured: %#v", errs) } return nil }