---
title: Prometheus Remote Write
slug: telemetry-pipeline/QWOl-prometheus-remote-write
docTags: 
createdAt: 2025-04-21T01:02:48.605Z
---

# Prometheus Remote Write Sink&#x20;

The **Prometheus Remote Write** sink delivers **metric data** to a Prometheus-compatible *remote write* endpoint (for example: Prometheus, Cortex, Thanos Receive, Mimir, or managed services that expose a remote write API).

## Important Warning: Cardinality

Prometheus strongly discourages **high cardinality** in:

- Metric names&#x20;
- Label sets (tags)&#x20;

High cardinality can cause:

- Increased memory usage and slow ingestion&#x20;
- Storage amplification&#x20;
- Query instability and operational incidents&#x20;

Operationally, you should:

- Limit label dimensions (avoid user/session/device identifiers as labels)&#x20;
- Prefer aggregation before export where possible&#x20;
- Apply cardinality controls upstream (worker provides transforms to enforce limits)&#x20;

## Core Connectivity

### endpoint (required)

- The full remote write URL (scheme + host + path).&#x20;
- This is the primary destination for metric batches.&#x20;
- Misconfiguration typically results in continuous retries and backlog growth (buffer pressure).&#x20;

##

## Authentication

### auth (optional)

Controls how requests authenticate to the remote write endpoint.

auth.strategy (required when auth is used)

Defines which authentication method is used:

- **aws:** For Amazon Managed Prometheus-style authentication (SigV4 / service-specific patterns)&#x20;
- **basic:** HTTP Basic Authentication (username + password)&#x20;
- **bearer:** Bearer token sent as-is (OAuth2/JWT/etc.)&#x20;

### Basic Authentication

auth.user (required with strategy = basic)

- Username used for HTTP Basic Authentication.&#x20;

auth.password (required with strategy = basic)

- Password used for HTTP Basic Authentication.&#x20;

### Bearer Authentication

auth.token (required with strategy = bearer)

- Token placed in the Authorization header as a bearer token.&#x20;
- Typically used for OAuth2 access tokens or JWT-based gateways.&#x20;

### AWS Authentication (for Managed Prometheus / AWS-compatible endpoints)

AWS auth supports multiple credential sourcing patterns:

auth.access\_key\_id / auth.secret\_access\_key (required in some setups)

- Static AWS credentials for signing requests.&#x20;

auth.session\_token (optional)

- Used for temporary credentials (short-lived sessions).&#x20;

auth.credentials\_file (required when using file-based credentials)

- Path to a credentials file containing AWS keys.&#x20;

auth.profile (optional)

- Selects which profile to use from the credentials file.&#x20;

auth.assume\_role (required when assuming a role)

- IAM Role ARN to assume before sending requests.&#x20;

auth.external\_id (optional)

- Additional identifier used in some cross-account role assumption scenarios.&#x20;

auth.session\_name (optional)

- Name used for the assumed role session.&#x20;
- Helps auditing and tracing activity in AWS logs.&#x20;

auth.region (optional)

- Region used to send STS requests (when relevant).&#x20;
- If omitted, defaults to the service region behavior.&#x20;

auth.load\_timeout\_secs (optional)

- Time limit to obtain credentials from the chain (including role assumption).&#x20;
- Important in environments where credentials may not be immediately available.&#x20;

auth.imds (optional)

IMDS options apply when credentials are obtained from instance metadata.

- **auth.imds.connect\_timeout\_seconds:** Connection timeout for IMDS calls&#x20;
- **auth.imds.read\_timeout\_seconds:** Read timeout for IMDS calls&#x20;
- **auth.imds.max\_attempts:** Retry attempts for token/metadata retrieval&#x20;

These settings matter in cloud environments where IMDS can be slow or restricted.

## AWS Service Targeting

### aws (optional)

Controls the target AWS service region/endpoint behavior.

aws.region (optional)

- Region of the target AWS service.&#x20;
- Can affect signing scope and endpoint selection.&#x20;

aws.endpoint (optional)

- Custom AWS-compatible endpoint.&#x20;
- Used for non-default environments or AWS-compatible services.&#x20;

## Batching Behavior

Remote write is batch-oriented; these settings directly influence throughput vs latency.

### batch (optional)

Controls how worker groups metrics into remote write payloads.

batch.aggregate (optional, default: true)

- When enabled, worker aggregates metrics within a batch before sending.&#x20;
- Typically reduces payload size and improves efficiency.&#x20;
- If disabled, payloads may be larger and more repetitive (higher ingestion load).&#x20;

batch.max\_events (optional, default: 1000)

- Maximum number of metric events in a batch before flush.&#x20;
- Smaller values lower latency but increase request rate.&#x20;

batch.max\_bytes (optional)

- Flushes when the uncompressed batch reaches this size limit.&#x20;
- Useful to prevent overly large payloads (which can cause request failures or longer server processing time).&#x20;

batch.timeout\_secs (optional, default: 1)

- Flushes when the batch reaches a certain age, even if size thresholds are not met.&#x20;
- Lower values reduce latency; higher values improve batching efficiency.&#x20;

## Distributions: Histograms and Summaries

Prometheus remote write commonly represents distributions as histograms or summaries. These settings define default behavior when worker has to convert distribution metrics.

### buckets (optional)

- Default histogram bucket boundaries used when converting distribution metrics into histograms.&#x20;
- Bucket choice affects:&#x20;
  - Accuracy of latency/size/duration representation&#x20;
  - Query usefulness (e.g., p95/p99 estimations)&#x20;
  - Storage cost (more buckets → more time series)&#x20;

### quantiles (optional)

- Quantiles used when converting distribution metrics into Prometheus summaries.&#x20;
- More quantiles can increase computational overhead and time series output.&#x20;

Operational tip: choose either histogram-centric or summary-centric strategy consistently to avoid confusion and unnecessary cardinality.

## Buffering and Backpressure

Batch sinks can accumulate backlog quickly when the remote endpoint slows down.

### buffer (optional)

Controls internal buffering while awaiting delivery.

buffer.type (optional, default: memory)

- **memory:** Higher performance, but data loss on crash/restart&#x20;
- **disk:** More durable, but slower and requires sufficient disk provisioning&#x20;

buffer.max\_size (required)

- Hard limit for buffer memory/disk usage.&#x20;
- If too small, you’ll hit backpressure or drops more often.&#x20;
- If too large (especially on disk), you must ensure adequate I/O and capacity planning.&#x20;

buffer.max\_events (optional; relevant for memory)

- Cap on number of buffered events (memory buffer only).&#x20;

buffer.when\_full (optional, default: block)

- **block:** Applies backpressure upstream (preferred for lossless pipelines)&#x20;
- **drop\_newest:** Drops newest events when full (preferred when “keep pipeline flowing” is more important than completeness)&#x20;

## Compression

### compression (optional, default: snappy)

Controls request payload compression:

- **snappy** is common for Prometheus remote write efficiency.&#x20;
- Stronger compression (zstd/gzip) can reduce bandwidth but increases CPU cost.&#x20;
- No compression increases bandwidth usage and may affect reliability on constrained links.&#x20;

## Metric Namespace Management

### default\_namespace (optional)

- Used only when incoming metrics do not already include a namespace.&#x20;
- When present, namespace becomes a prefix to the metric name, separated by underscore.&#x20;
- Helps enforce naming consistency and avoid collisions.&#x20;

## Stateful Cache Control

### expire\_metrics\_secs (optional)

- Controls how long **incremental metrics** remain in the internal cache without updates.&#x20;
- If not configured and you receive continuously “new” unique incremental series, memory usage can grow indefinitely.&#x20;
- This setting is critical for long-running agents in dynamic environments (e.g., Kubernetes with changing label sets).&#x20;

## Healthcheck

### healthcheck.enabled (optional, default: true)

- Enables startup validation that the remote endpoint is reachable/healthy.&#x20;
- Helps fail fast during deployment rather than silently buffering and retrying indefinitely.&#x20;

## Inputs

### inputs (required)

- Identifies which upstream metric sources/transforms feed this sink.&#x20;
- Supports wildcards for large topologies.&#x20;

## Proxy Support

### proxy (optional)

Routes outbound HTTP(S) requests via proxy infrastructure.

proxy.enabled (optional, default: true)

- Enables proxy usage when proxy settings exist.&#x20;

proxy.http / proxy.https (optional)

- Proxy endpoints for HTTP and HTTPS traffic.&#x20;

proxy.no\_proxy (optional)

- Host patterns that should bypass proxy.&#x20;
- Useful for keeping internal traffic direct while proxying external traffic.&#x20;

## Request Behavior (Concurrency, Retries, Timeouts)

This group determines stability under load, failure recovery behavior, and duplicate likelihood (given at-least-once delivery).

### request (optional)

request.concurrency (optional, default: adaptive)

- **none:** One outstanding request at a time (predictable but can bottleneck)&#x20;
- **adaptive:** worker automatically adjusts concurrency based on observed performance&#x20;

Adaptive concurrency is usually best for mixed network conditions, but should be used carefully in very sensitive environments.

request.adaptive\_concurrency (optional)

Fine-tunes the adaptive algorithm:

- **initial\_concurrency:** starting point after restart&#x20;
- **max\_concurrency\_limit:** safety ceiling&#x20;
- **decrease\_ratio:** how aggressively concurrency is reduced when latency increases&#x20;
- **ewma\_alpha:** how quickly the baseline adapts to new RTT patterns&#x20;
- **rtt\_deviation\_scale:** how tolerant the system is to RTT variance before reacting&#x20;

Incorrect tuning can lead to unstable oscillations or slow recovery.

request.timeout\_secs (optional, default: 60)

- Maximum request duration before aborting.&#x20;
- If set too low, you can create retry storms and duplicate writes (because the server may still process the original request).&#x20;

request.retry\_attempts (optional)

- Maximum retry count for failed requests.&#x20;
- Very high values can cause long retry tails and prolonged backlog.&#x20;

request.retry\_initial\_backoff\_secs (optional, default: 1)

- Initial delay before first retry.&#x20;
- Subsequent retries follow Fibonacci backoff.&#x20;

request.retry\_max\_duration\_secs (optional, default: 30)

- Upper bound on delay between retries.&#x20;

request.retry\_jitter\_mode (optional, default: Full)

- Randomizes retry delays to reduce synchronized retry bursts across many agents.&#x20;

request.rate\_limit\_num / request.rate\_limit\_duration\_secs

- Limits outbound request rate.&#x20;
- Useful to protect the remote write endpoint or avoid saturating a constrained network link.&#x20;

## Multi-Tenancy

### tenant\_id (optional)

- Adds the X-Scope-OrgID header to outbound requests.&#x20;
- Used by multi-tenant remote write backends (e.g., Cortex/Mimir-like systems).&#x20;
- Supports templating, allowing tenant to be derived from the metric/event context.&#x20;

## TLS

### tls (optional)

Secures outbound connections and controls certificate verification behavior.

Key options include:

- **tls.ca\_file:** additional trusted CA bundle&#x20;
- **tls.crt\_file / tls.key\_file:** client certificate authentication (mTLS)&#x20;
- **tls.key\_pass:** decrypting an encrypted private key&#x20;
- **tls.server\_name:** SNI override for TLS&#x20;
- **tls.verify\_certificate:** validates certificate chain trust&#x20;
- **tls.verify\_hostname:** validates hostname matches certificate identity&#x20;
- **tls.alpn\_protocols:** protocol negotiation hints where relevant&#x20;

Operational guidance: disabling certificate/hostname verification is risky and should be avoided except in tightly controlled test environments.
