mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-03-23 21:19:35 +02:00
Do not alloc multiple noop exporters (#5083)
This commit is contained in:
parent
ca5bb1f54c
commit
12c5651ec7
@ -41,6 +41,8 @@ type Exporter interface {
|
||||
ForceFlush(ctx context.Context) error
|
||||
}
|
||||
|
||||
var defaultNoopExporter = &noopExporter{}
|
||||
|
||||
type noopExporter struct{}
|
||||
|
||||
func (noopExporter) Export(context.Context, []Record) error { return nil }
|
||||
|
@ -27,7 +27,7 @@ type SimpleProcessor struct {
|
||||
func NewSimpleProcessor(exporter Exporter) *SimpleProcessor {
|
||||
if exporter == nil {
|
||||
// Do not panic on nil exporter.
|
||||
exporter = noopExporter{}
|
||||
exporter = defaultNoopExporter
|
||||
}
|
||||
return &SimpleProcessor{exporter: exporter}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user