Send OpenTelemetry to Google Cloud Storage
Export OTLP logs, spans and metrics to Send2Bucket to keep the raw records in your Cloud Storage bucket. Send2Bucket writes gzip NDJSON files partitioned by date and hour. Google Cloud’s own OTLP endpoint, telemetry.googleapis.com, sends telemetry to Cloud Logging, Cloud Monitoring and Cloud Trace.
1. Grant Send2Bucket access to the bucket
Create an ingestion stream in the dashboard and add a Google Cloud Storage destination with a bucket and a prefix. Send2Bucket writes with its own service account, shown on the destination, so no keys change hands. Grant it object create and read on the bucket:
SA=<gcs_service_account>
gcloud storage buckets add-iam-policy-binding gs://<bucket> \
--member="serviceAccount:$SA" --role="roles/storage.objectCreator"
gcloud storage buckets add-iam-policy-binding gs://<bucket> \
--member="serviceAccount:$SA" --role="roles/storage.objectViewer"
Select Verify: Send2Bucket writes a test object under <prefix>/s2b/ and reads it back. Google Cloud Storage shows how to limit the grant to the prefix with an IAM condition.
2. Point your SDKs or Collector at Send2Bucket
Set the standard exporter variables in each service's environment, with the stream's API key:
export OTEL_SERVICE_NAME=checkout
export OTEL_EXPORTER_OTLP_ENDPOINT=https://api.send2bucket.com
export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
export OTEL_EXPORTER_OTLP_HEADERS="authorization=Bearer%20$S2B_API_KEY"
Services on GKE or Cloud Run that already send to a Collector can keep it: add an otlphttp exporter with the same endpoint and header, as in Or keep the Collector you run. The OTLP JSON encoding is not accepted; use protobuf over HTTP or gRPC.
3. Check the first objects
gcloud storage ls --recursive "gs://<bucket>/<prefix>/s2b/stream=*" | head
Objects appear within about a minute, at <prefix>/s2b/stream=<stream_id>/date=YYYY-MM-DD/hour=HH/<delivery_batch_id>.ndjson.gz. The dashboard shows the destination's status and last error if they do not.
4. Query from BigQuery
Create the s2b.raw_lines external table and the s2b.records view from BigQuery. The external table reads the objects in place, so new deliveries show up in the next query. Then:
Spans with an error status (2 is STATUS_CODE_ERROR) per operation, for one day:
SELECT JSON_VALUE(data, '$.name') AS span, COUNT(*) AS errors
FROM s2b.records
WHERE date = '2026-11-21'
AND signal = 'span'
AND CAST(JSON_VALUE(data, '$.status.code') AS INT64) = 2
GROUP BY span
ORDER BY errors DESC;
p95 latency per operation:
SELECT JSON_VALUE(data, '$.name') AS span,
APPROX_QUANTILES((CAST(JSON_VALUE(data, '$.endTimeUnixNano') AS INT64)
- CAST(JSON_VALUE(data, '$.startTimeUnixNano') AS INT64)) / 1e6, 100)[OFFSET(95)] AS p95_ms,
COUNT(*) AS spans
FROM s2b.records
WHERE date = '2026-11-21' AND signal = 'span'
GROUP BY span
ORDER BY p95_ms DESC;
- Filter on
date, andhourif you can: BigQuery then reads only those folders, which bounds the bytes billed. - For dashboards that query the same days repeatedly, load finished days into a native table, as the BigQuery guide shows.
DuckDB reads the same objects with an HMAC key, and the queries in Query the telemetry run unchanged on a gs:// path.
What lands in the bucket
Each line is one log record, span or metric in the OTLP JSON mapping, with resource and scope copied on, inside the envelope described in Delivery format. Attributes are lists of {key, value}, enums are integers and 64-bit integers are strings.
Limits and costs
- A request can be up to 8 MiB decompressed; a single log record, span or metric has no separate limit.
- Send2Bucket bills the stored JSON of each log record, span or metric it accepts (Plans and billing). Google bills Cloud Storage storage and operations, and BigQuery bills the bytes each query reads.
- The service account can create and read objects but not delete them. Use an Object Lifecycle Management rule on
<prefix>/s2b/to expire old objects.