diff --git a/exporter/exporterhelper/internal/bounded_memory_queue.go b/exporter/exporterhelper/internal/bounded_memory_queue.go index 1f33580168a..18c64a9d4b6 100644 --- a/exporter/exporterhelper/internal/bounded_memory_queue.go +++ b/exporter/exporterhelper/internal/bounded_memory_queue.go @@ -81,7 +81,3 @@ func (q *boundedMemoryQueue) Size() int { func (q *boundedMemoryQueue) Capacity() int { return cap(q.items) } - -func (q *boundedMemoryQueue) IsPersistent() bool { - return false -} diff --git a/exporter/exporterhelper/internal/persistent_queue.go b/exporter/exporterhelper/internal/persistent_queue.go index b93a03b4fbc..a8eb6687ca1 100644 --- a/exporter/exporterhelper/internal/persistent_queue.go +++ b/exporter/exporterhelper/internal/persistent_queue.go @@ -107,10 +107,6 @@ func (pq *persistentQueue) Capacity() int { return int(pq.capacity) } -func (pq *persistentQueue) IsPersistent() bool { - return true -} - func toStorageClient(ctx context.Context, storageID component.ID, host component.Host, ownerID component.ID, signal component.DataType) (storage.Client, error) { extension, err := getStorageExtension(host.GetExtensions(), storageID) if err != nil { diff --git a/exporter/exporterhelper/internal/queue.go b/exporter/exporterhelper/internal/queue.go index 0ba167a191b..63c125ac0c0 100644 --- a/exporter/exporterhelper/internal/queue.go +++ b/exporter/exporterhelper/internal/queue.go @@ -31,7 +31,4 @@ type Queue interface { Shutdown(ctx context.Context) error // Capacity returns the capacity of the queue. Capacity() int - // IsPersistent returns true if the queue is persistent. - // TODO: Do not expose this method if the interface moves to a public package. - IsPersistent() bool } diff --git a/exporter/exporterhelper/queue_sender.go b/exporter/exporterhelper/queue_sender.go index 75cf9e2d4be..e0f3f3422ae 100644 --- a/exporter/exporterhelper/queue_sender.go +++ b/exporter/exporterhelper/queue_sender.go @@ -88,12 +88,14 @@ type queueSender struct { func newQueueSender(config QueueSettings, set exporter.CreateSettings, signal component.DataType, marshaler RequestMarshaler, unmarshaler RequestUnmarshaler) *queueSender { + + isPersistent := config.StorageID != nil var queue internal.Queue - if config.StorageID == nil { - queue = internal.NewBoundedMemoryQueue(config.QueueSize, config.NumConsumers) - } else { + if isPersistent { queue = internal.NewPersistentQueue(config.QueueSize, config.NumConsumers, *config.StorageID, queueRequestMarshaler(marshaler), queueRequestUnmarshaler(unmarshaler), set) + } else { + queue = internal.NewBoundedMemoryQueue(config.QueueSize, config.NumConsumers) } return &queueSender{ fullName: set.ID.String(), @@ -103,7 +105,7 @@ func newQueueSender(config QueueSettings, set exporter.CreateSettings, signal co logger: set.TelemetrySettings.Logger, meter: set.TelemetrySettings.MeterProvider.Meter(scopeName), // TODO: this can be further exposed as a config param rather than relying on a type of queue - requeuingEnabled: queue.IsPersistent(), + requeuingEnabled: isPersistent, } }