$ 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
Configure Prometheus
Add this to prometheus.yml. Each series then lands in your bucket as one line like the one beside it.
remote_write:
- url: https://api.send2bucket.com/api/v1/write
authorization:
credentials: <key>
headers:
S2b-Stream: <stream_id>
{
"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.
| version | message | in prometheus.yml |
|---|---|---|
| 1.0 | prometheus.WriteRequest | the default |
| 2.0 | io.prometheus.write.v2.Request | protobuf_message: io.prometheus.write.v2.Request |
Response codes and retries
Use the response code to distinguish a rejected request from a retryable failure.
| status | meaning |
|---|---|
| 204 | every series stored |
| 400 | some series rejected, the rest stored; the body names why, and Prometheus does not resend |
| 415 | another content type or encoding; Accept lists the supported ones |
| 429, 503 | quota 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.
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.