Googlecloudstorage Exporter
contrib
Maintainers: @constanca-m, @braydonk
Source: opentelemetry-collector-contrib
Supported Telemetry
Overview
This exporter writes received OpenTelemetry data to a cloud storage bucket.Configuration
| Name | Description | Required | Default |
|---|---|---|---|
encoding | The encoding extension ID to use for marshaling logs and traces. If left empty, plog.JSONMarshaler will be used for logs and ptrace.JSONMarshaler will be used for traces. | No | |
bucket.project_id | The project where the bucket will be created or where it exists. If left empty, it will query the metadata endpoint. It requires the collector to be running in a Google Cloud environment. | No | |
bucket.name | Name for the bucket storage. | Yes | |
bucket.file_prefix | Prefix for the created filename. This prefix is applied after the partition path (if any). | No | logs |
bucket.partition | Configuration for time-based partitioning. See below for details. | No | |
bucket.reuse_if_exists | Controls bucket creation behavior. If true, checks if bucket exists and uses it (requires storage.buckets.get permission on the bucket); fails if bucket doesn’t exist. If false, attempts to create bucket; fails if bucket already exists (requires storage.buckets.create permission at project level). Set to true when the service account lacks project-level bucket creation permissions but has bucket-level permissions. | No | false |
bucket.region | Region where the bucket will be created or where it exists. If left empty, it will query the metadata endpoint. It requires the collector to be running in a Google Cloud environment. | Yes | |
bucket.compression | Compression algorithm used to compress data before uploading. Valid values are gzip, zstd, or no value set for no compression. | No | |
timeout | Time to wait per individual attempt to send data to the backend. See exporterhelper docs for details. | No | 5s |
retry_on_failure | Configuration for how to retry failed requests. See exporterhelper docs for details. | No | |
sending_queue | Configuration for the internal sending queue. See exporterhelper docs for details. | No |
Partition Configuration
Thebucket.partition configuration allows you to organize files into time-based folders.
| Name | Description | Required | Default |
|---|---|---|---|
format | Time format string for time-based partitions. If set, formatted UTC time is prepended to the filename. Supports strftime format (e.g., year=%Y/month=%m). | No | |
prefix | Prefix for the partition folder structure. If set, this value is prepended to the partition path. | No |
Example
Here is an example configuration for this exporter:Resiliency Settings
This exporter supports standard OpenTelemetry Collector resiliency settings. You can configure timeouts, retry behaviors, and a sending queue to ensure reliable data delivery to Google Cloud Storage.Retry Behavior
This exporter utilizes two independent layers of retries: Google Cloud SDK Retries (always on): The underlying Google Cloud Go SDK automatically retries transient errors (like network blips) in the background. By default, the SDK handles its own exponential backoff and idempotency checks. Exporter Helper Retries (optional via retry_on_failure): This is the OpenTelemetry-level retry mechanism. It integrates with the sending queue to ensure data is not dropped during prolonged outages. Important Notes on Retries: If the Google Cloud SDK determines an error is permanent (e.g., unauthorized access) or not idempotent, the exporter will immediately wrap it as a permanent error. This halts theretry_on_failure loop and drops the payload to prevent infinite queue blocking. You can find more information on what the SDK considers retryable in the Google Cloud Storage Retry Strategy documentation.
Because file names are generated dynamically using a UUID and timestamp, each retry attempt by the OpenTelemetry retry_on_failure mechanism generates a new filename. In rare cases (such as when GCS commits an object but returns a transient error before the client receives acknowledgment) this can result in duplicate blobs in GCS.
Compression Example
Using with Bucket-Level Permissions Only
When the service account lacks project-level bucket creation permissions but has bucket-level permissions:reuse_if_exists: true, the exporter checks if the bucket exists using storage.buckets.get permission on that specific bucket (not project-level). If the bucket doesn’t exist, the exporter will fail with an error. This allows service accounts with only bucket-level permissions to work without requiring project-level bucket creation permissions.
Configuration
Example Configuration
Last generated: 2026-06-01