Skip to main content

$ s2b remote-write --help

Prometheus remote write into your own bucket

Configure remote_write to send time series to your S3 or GCS bucket or Iceberg table. Each record includes the labels, samples, exemplars and native histograms that Prometheus sends.

  • [ok] remote write 1.0 and 2.0, snappy protobuf
  • [ok] one line per series, labels as an object
  • [ok] 2.0 metric type, help and unit kept
  • [ok] checked against a stock Prometheus on every change
http_requests_total{job="checkout"} ─▶ your bucket ─▶ panelprometheusscrape 15s/api/v1/writesnappy 1.0/2.0s3://metricsndjson.gz/hourduckdbSELECT …dashboardreq/s · p99panel · rate(http_requests_total[5m])227 req/s

Configure Prometheus

Add this to prometheus.yml. Each series then lands in your bucket as one line like the one beside it.

prometheus.yml
remote_write:
  - url: https://api.send2bucket.com/api/v1/write
    authorization:
      credentials: <key>
    headers:
      S2b-Stream: <stream_id>
-> your bucket, the data of one series line
{
  "labels": {
    "__name__": "http_requests_total",
    "code": "200",
    "job": "checkout"
  },
  "samples": [
    {
      "timestamp": "1795057449000",
      "value": 1027
    }
  ]
}

Remote write 1.0 and 2.0

Both versions write the same line. 2.0 adds the metric type, help and unit, and sample start timestamps, and its responses report what was written.

versionmessagein prometheus.yml
1.0prometheus.WriteRequestthe default
2.0io.prometheus.write.v2.Requestprotobuf_message: io.prometheus.write.v2.Request

Response codes and retries

Use the response code to distinguish a rejected request from a retryable failure.

statusmeaning
204every series stored
400some series rejected, the rest stored; the body names why, and Prometheus does not resend
415another content type or encoding; Accept lists the supported ones
429, 503quota or capacity; Prometheus retries after Retry-After

Query stored series

Series are records with signal series, next to your events, logs and spans. See the Delivery format for every field.

duckdb · one row per sample
SELECT data->>'$.labels.__name__' AS metric,
       data->>'$.labels.job' AS job,
       epoch_ms(CAST(s->>'timestamp' AS BIGINT)) AS at,
       CAST(s->>'value' AS DOUBLE) AS value
FROM read_json('s3://<bucket>/<prefix>/s2b/stream=*/date=*/hour=*/*.ndjson.gz',
               columns = {signal: 'VARCHAR', data: 'JSON'}),
     unnest(CAST(data->'$.samples' AS JSON[])) AS t(s)
WHERE signal = 'series';

frequently asked questions

Which remote write versions does Send2Bucket accept?

Remote write 1.0 (prometheus.WriteRequest) and 2.0 (io.prometheus.write.v2.Request), as snappy-compressed protobuf. Prometheus sends 1.0 unless protobuf_message selects 2.0.

Which endpoint do I point remote_write at?

https://api.send2bucket.com/api/v1/write, also served at /v1/prometheus/write. Send the API key as the bearer credential, and the stream in the S2b-Stream header unless the key writes to one stream only.

What lands in my bucket?

One JSON line per time series and request, with signal series: the labels as an object, the samples, and any exemplars and native histograms. Lines from 2.0 also carry the metric type, help and unit.

Can I query the series with PromQL or Grafana’s Prometheus data source?

No. Send2Bucket stores the series in your bucket or table, and you query them with SQL in DuckDB, Trino, Athena, BigQuery or another engine. For dashboards and alerts on live data, keep a Prometheus-compatible database and remote write to both.

What happens to a series Send2Bucket rejects?

A series with an empty or repeated label name, or in 2.0 a reference to a missing symbol, is rejected. The rest of the request is stored, and the 400 response names the reasons, so Prometheus does not resend what was stored.

How is remote write billed?

Like every other endpoint: by the stored JSON of each series Send2Bucket accepts, whatever the compression. A request with rejected series is metered on the series it stored.

Does stream aggregation apply to Prometheus series?

Not yet. Aggregation rules cover JSON events, OpenTelemetry logs and spans, and gauge and sum metric points; series lines are always delivered raw.

Send your first series

Create a stream and an API key in the dashboard, then add the remote_write block to prometheus.yml.