What is `remote_write` and how does it work internally?

AdvancedConceptPrometheus Architecture
Answer

remote_write streams samples to a remote endpoint (Mimir, Thanos Receive, Cortex, VictoriaMetrics, Amazon Managed Prometheus) as snappy-compressed protobuf. Prometheus tails its own WAL and sends via sharded queues that scale up and down with throughput.

remote_write:
  - url: https://mimir.example.com/api/v1/push
    queue_config:
      max_shards: 50
      capacity: 10000
      max_samples_per_send: 2000

If the remote is down, data buffers in the WAL (about 2 hours). Watch prometheus_remote_storage_samples_pending and prometheus_remote_storage_highest_timestamp_in_seconds minus queue_highest_sent_timestamp_seconds for lag. Remote Write 2.0 adds metadata and exemplars natively.

All Monitoring & Observability questions Roadmap: Monitoring & alerting

More on Prometheus Architecture