opentelemetry-collector/exporter/exporterhelper
Chao Weng 6de29ce169 Add `component.Type` parameter to `NewNopSettings` And deprecate `NewNopSettingsWithType` (#12452)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
Add `component.Type` parameter to `NewNopSettings` And deprecate
`NewNopSettingsWithType` cc @mx-psi

<!-- Issue number if applicable -->
#### Link to tracking issue
Relevant to #12305 

<!--Describe what testing was performed and which tests were added.-->
#### Testing
Updated

<!--Describe the documentation added.-->
#### Documentation
Added

<!--Please delete paragraphs that you did not use before submitting.-->
2025-02-21 11:17:45 +00:00
..
internal Add `component.Type` parameter to `NewNopSettings` And deprecate `NewNopSettingsWithType` (#12452) 2025-02-21 11:17:45 +00:00
xexporterhelper Add `component.Type` parameter to `NewNopSettings` And deprecate `NewNopSettingsWithType` (#12452) 2025-02-21 11:17:45 +00:00
README.md [chore] Update exporterhelper README.md (#12364) 2025-02-12 04:57:23 +00:00
common.go [exporter] moved mergeBatchFunc and mergeBatchSplitFunc to request (#11459) 2024-10-21 13:39:25 -07:00
constants.go [exporterhelper] Replace experimental converter interface with function (#8764) 2023-11-17 09:08:49 -08:00
doc.go [chore] use mdatagen for exporterhelper metrics (#10094) 2024-05-08 12:11:10 -07:00
documentation.md [service] update telemetry level to reflect their state (#11729) 2024-11-22 09:53:18 -08:00
exporterhelper.go [chore] Move code from exporter/internal to exporterhelper/internal (#12342) 2025-02-11 18:55:54 +00:00
generated_package_test.go [chore] use mdatagen for exporterhelper metrics (#10094) 2024-05-08 12:11:10 -07:00
logs.go [chore] Remove obssender factory from BaseExporter, merge obs reporter/sender (#12338) 2025-02-11 05:15:43 +00:00
logs_batch.go Fix MergeSplit issue that ignores the initial message size (#12257) 2025-02-03 21:28:57 +00:00
logs_batch_test.go [chore] Move code from exporter/internal to exporterhelper/internal (#12342) 2025-02-11 18:55:54 +00:00
logs_test.go Add `component.Type` parameter to `NewNopSettings` And deprecate `NewNopSettingsWithType` (#12452) 2025-02-21 11:17:45 +00:00
metadata.yaml [chore] add githubgen to enhance codeowners and issue templates (#11756) 2025-02-06 10:31:36 +00:00
metrics.go [chore] Remove obssender factory from BaseExporter, merge obs reporter/sender (#12338) 2025-02-11 05:15:43 +00:00
metrics_batch.go Fix MergeSplit issue that ignores the initial message size (#12257) 2025-02-03 21:28:57 +00:00
metrics_batch_test.go Fix MergeSplit issue that ignores the initial message size (#12257) 2025-02-03 21:28:57 +00:00
metrics_test.go Add `component.Type` parameter to `NewNopSettings` And deprecate `NewNopSettingsWithType` (#12452) 2025-02-21 11:17:45 +00:00
queue_sender.go [chore] Move code from exporter/internal to exporterhelper/internal (#12342) 2025-02-11 18:55:54 +00:00
retry_sender.go [chore] split exporterhelper so a separate profiles module can use it (#11215) 2024-09-19 13:17:38 +02:00
timeout_sender.go [exporterhelper] Remove deprecated aliases for Queue/TimeoutSettings (#11264) 2024-09-25 09:44:44 -07:00
traces.go [chore] Remove obssender factory from BaseExporter, merge obs reporter/sender (#12338) 2025-02-11 05:15:43 +00:00
traces_batch.go Fix MergeSplit issue that ignores the initial message size (#12257) 2025-02-03 21:28:57 +00:00
traces_batch_test.go Fix MergeSplit issue that ignores the initial message size (#12257) 2025-02-03 21:28:57 +00:00
traces_test.go Add `component.Type` parameter to `NewNopSettings` And deprecate `NewNopSettingsWithType` (#12452) 2025-02-21 11:17:45 +00:00

README.md

Exporter Helper

This is a helper exporter that other exporters can depend on. Today, it primarily offers queued retry capabilities.

⚠️ This exporter should not be added to a service pipeline.

Configuration

The following configuration options can be modified:

  • retry_on_failure
    • enabled (default = true)
    • initial_interval (default = 5s): Time to wait after the first failure before retrying; ignored if enabled is false
    • max_interval (default = 30s): Is the upper bound on backoff; ignored if enabled is false
    • max_elapsed_time (default = 300s): Is the maximum amount of time spent trying to send a batch; ignored if enabled is false. If set to 0, the retries are never stopped.
  • sending_queue
    • enabled (default = true)
    • num_consumers (default = 10): Number of consumers that dequeue batches; ignored if enabled is false
    • blocking (default = false): If true, blocks the request until the queue has space otherwise returns immediately; ignored if enabled is false
    • queue_size (default = 1000): Maximum number of batches kept in memory before dropping; ignored if enabled is false. User should calculate this as num_seconds * requests_per_second / requests_per_batch where:
      • num_seconds is the number of seconds to buffer in case of a backend outage
      • requests_per_second is the average number of requests per seconds
      • requests_per_batch is the average number of requests per batch (if the batch processor is used, the metric send_batch_size can be used for estimation)
  • timeout (default = 5s): Time to wait per individual attempt to send data to a backend

The initial_interval, max_interval, max_elapsed_time, and timeout options accept duration strings, valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".

Persistent Queue

To use the persistent queue, the following setting needs to be set:

  • sending_queue
    • storage (default = none): When set, enables persistence and uses the component specified as a storage extension for the persistent queue. There is no in-memory queue when set.

The maximum number of batches stored to disk can be controlled using sending_queue.queue_size parameter (which, similarly as for in-memory buffering, defaults to 1000 batches).

When persistent queue is enabled, the batches are being buffered using the provided storage extension - filestorage is a popular and safe choice. If the collector instance is killed while having some items in the persistent queue, on restart the items will be picked and the exporting is continued.

                                                              ┌─Consumer #1─┐
                                                              │    ┌───┐    │
                              ──────Deleted──────        ┌───►│    │ 1 │    ├───► Success
        Waiting in channel    x           x     x        │    │    └───┘    │
        for consumer ───┐     x           x     x        │    │             │
                        │     x           x     x        │    └─────────────┘
                        ▼     x           x     x        │
┌─────────────────────────────────────────x─────x───┐    │    ┌─Consumer #2─┐
│                             x           x     x   │    │    │    ┌───┐    │
│     ┌───┐     ┌───┐ ┌───┐ ┌─x─┐ ┌───┐ ┌─x─┐ ┌─x─┐ │    │    │    │ 2 │    ├───► Permanent -> X
│ n+1 │ n │ ... │ 6 │ │ 5 │ │ 4 │ │ 3 │ │ 2 │ │ 1 │ ├────┼───►│    └───┘    │      failure
│     └───┘     └───┘ └───┘ └───┘ └───┘ └───┘ └───┘ │    │    │             │
│                                                   │    │    └─────────────┘
└───────────────────────────────────────────────────┘    │
   ▲              ▲     ▲           ▲                    │    ┌─Consumer #3─┐
   │              │     │           │                    │    │    ┌───┐    │
   │              │     │           │                    │    │    │ 3 │    ├───► (in progress)
 write          read    └─────┬─────┘                    ├───►│    └───┘    │
 index          index         │                          │    │             │
                              │                          │    └─────────────┘
                              │                          │
                          currently                      │    ┌─Consumer #4─┐
                          dispatched                     │    │    ┌───┐    │     Temporary
                                                         └───►│    │ 4 │    ├───►  failure
                                                              │    └───┘    │         │
                                                              │             │         │
                                                              └─────────────┘         │
                                                                     ▲                │
                                                                     └── Retry ───────┤
                                                                                      │
                                                                                      │
                                                   X  ◄────── Retry limit exceeded ───┘

Example:

receivers:
  otlp:
    protocols:
      grpc:
exporters:
  otlp:
    endpoint: <ENDPOINT>
    sending_queue:
      storage: file_storage/otc
extensions:
  file_storage/otc:
    directory: /var/lib/storage/otc
    timeout: 10s
service:
  extensions: [file_storage]
  pipelines:
    metrics:
      receivers: [otlp]
      exporters: [otlp]
    logs:
      receivers: [otlp]
      exporters: [otlp]
    traces:
      receivers: [otlp]
      exporters: [otlp]