Files
155fb0264e [Exporterhelper Exporter] Enable metadata population in exporterhelper when sending_queue is enabled (#14139)
#### Description
Feature: The enablement of the sending_queue in the configuration of the
otplhttp exporter does not preserve the metadata information of the
initial context.

This pr introduces a new configuration called `metadata_keys` that will
be used in the exporter config

#### Testing

- Added partionetr_test 

- Built my local otlp exporter

Configuration of otlphttp:

```yaml
otlphttp:
  endpoint: https://endpoint.invalid/_otlp
  timeout: {{ .http_request_timeout | quote }}
  sending_queue:
    enabled: true
    wait_for_result: false
    block_on_overflow: true  # false = data loss on queue full
    sizer: requests
    queue_size: {{ .queuedRequests }}
    batch:
      partition:
        metadata_keys:
          - project-id
          - tenant-id
```

See "ProjectID":"local" that is populated below in my logs
```yaml
{"log.level":"info","@timestamp":"2025-11-06T15:51:49.955Z","message":"ecpRoutingRoundTripper: after URL modification","resource":{"cloud.availability_zone":"local","k8s.namespace.name":"motel-index-collector","k8s.node.name":"hotel-worker2","k8s.pod.name":"motel-index-collector-local-58484b67c8-l4vrt","k8s.pod.uid":"1a8f6fad-91b6-413a-a929-6d004ca489b3","orchestrator.cluster.name":"default","orchestrator.deploymentslice":"","orchestrator.environment":"default","service.instance.id":"ecf43bce-5aac-444c-b244-8871bbf2d69a","service.name":"motel-index-collector","service.version":"git"},"otelcol.component.id":"ecproutingmiddleware","otelcol.component.kind":"extension","final_url_host":"local.es.svc.cluster.local:9200","final_url_scheme":"http","final_url":"[http://local.es.svc.cluster.local:9200/_otlp/v1/metrics","final_host":"","ProjectID":"local","header_count":6,"ecs.version":"1.6.0"}](http://local.es.svc.cluster.local:9200/_otlp/v1/metrics%22,%22final_host%22:%22%22,%22ProjectID%22:%22local%22,%22header_count%22:6,%22ecs.version%22:%221.6.0%22%7D)
```

This PR is a feature for exporterhelper, so is not just
otlphttp-specific.

---------

Signed-off-by: Andreas Gkizas <[email protected]>
Co-authored-by: Andrew Wilkins <[email protected]>
2026-02-26 16:50:58 +00:00

56 lines
3.1 KiB
YAML

$defs:
batch_config:
description: BatchConfig defines a configuration for batching requests based on a timeout and a minimum number of items.
type: object
properties:
flush_timeout:
description: FlushTimeout sets the time after which a batch will be sent regardless of its size.
type: string
x-customType: time.Duration
format: duration
max_size:
description: MaxSize defines the configuration for the maximum size of a batch.
type: integer
x-customType: int64
min_size:
description: MinSize defines the configuration for the minimum size of a batch.
type: integer
x-customType: int64
sizer:
description: Sizer determines the type of size measurement used by the batch. If not configured, use the same configuration as the queue. It accepts "requests", "items", or "bytes".
type: string
x-customType: go.opentelemetry.io/collector/exporter/exporterhelper/internal/request.SizerType
config:
description: Config defines configuration for queueing and batching incoming requests.
type: object
properties:
batch:
description: BatchConfig it configures how the requests are consumed from the queue and batch together during consumption.
x-optional: true
$ref: batch_config
block_on_overflow:
description: BlockOnOverflow determines the behavior when the component's TotalSize limit is reached. If true, the component will wait for space; otherwise, operations will immediately return a retryable error.
type: boolean
enabled:
description: Enabled indicates whether to not enqueue and batch before exporting.
type: boolean
num_consumers:
description: NumConsumers is the maximum number of concurrent consumers from the queue. This applies across all different optional configurations from above (e.g. wait_for_result, block_on_overflow, storage, etc.).
type: integer
queue_size:
description: QueueSize represents the maximum data size allowed for concurrent storage and processing.
type: integer
x-customType: int64
sizer:
description: Sizer determines the type of size measurement used by this component. It accepts "requests", "items", or "bytes".
type: string
x-customType: go.opentelemetry.io/collector/exporter/exporterhelper/internal/request.SizerType
storage:
description: 'StorageID if not empty, enables the persistent storage and uses the component specified as a storage extension for the persistent queue. TODO: This will be changed to Optional when available. See https://github.com/open-telemetry/opentelemetry-collector/issues/13822'
x-pointer: true
type: string
x-customType: go.opentelemetry.io/collector/component.ID
wait_for_result:
description: WaitForResult determines if incoming requests are blocked until the request is processed or not. Currently, this option is not available when persistent queue is configured using the storage configuration.
type: boolean