Googlecloudpubsub Receiver
contrib
Maintainers: @alexvanboxel
Source: opentelemetry-collector-contrib
Supported Telemetry
Overview
ā ļø This is a community-provided module. It has been developed and extensively tested at Collibra, but it is not officially supported by GCP.The following configuration options are supported:
project(Optional): The Google Cloud Project of the client connects to.subscription(Required): The subscription name to receive OTLP data from. The subscription name should be a fully qualified resource name (eg:projects/otel-project/subscriptions/otlp).encoding(Optional): The encoding that will be used to received data from the subscription. This can either beotlp_proto_trace,otlp_proto_metric,otlp_proto_logor and encoding extension (seeencoding). This will only be used as a fallback, when nocontent-typeattribute is present.compression(Optional): The compression that will be used on received data from the subscription. When set it can only begzip. This will only be used as a fallback, when nocontent-encodingattribute is present.endpoint(Optional): Override the default Pubsub Endpoint, useful when connecting to the PubSub emulator instance or switching between global and regional service endpoints.insecure(Optional): allows performing āinsecureā SSL connections and transfers, useful when connecting to a local emulator instance. Only has effect if Endpoint is not ""ignore_encoding_error(Optional): Ignore errors when the configured encoder fails to decoding a PubSub messages. Itās advised to set this totruewhen using a custom encoder, and usereceiver.googlecloudpubsub.encoding_errormetric to monitor the number of errors. Ignoring the error will cause the receiver to drop the message.flow_control(Optional): Allows to fine tune the flow control settings for the subscription stream. See Flow control for more details.
Encoding
Theencoding options allows you to specify Encoding Extensions for decoding messages on the subscription. An
extension need to be configured in the extensions section, and added to pipeline in the collectors configuration file.
The following example shows how to use the text encoding extension for ingesting arbitrary text message on a
subscription, wrapping them in OTLP Log messages. Note that not all extensions support all signals.
| encoding | description |
|---|---|
| otlp_proto_trace | Decode OTLP trace message |
| otlp_proto_metric | Decode OTLP trace message |
| otlp_proto_log | Decode OTLP trace message |
cloud_logging and raw_text where removed since v0.132.0, use the encoding extensions
googlecloudlogentry and text encoding extension instead.
When no encoding is specified, the receiver will try to discover the type of the data by looking at the ce-type and
content-type attributes of the message. These message attributes are set by the googlepubsubexporter.
| ce-type | ce-datacontenttype | encoding | description |
|---|---|---|---|
| org.opentelemetry.otlp.traces.v1 | application/protobuf | Decode OTLP trace message | |
| org.opentelemetry.otlp.metrics.v1 | application/protobuf | Decode OTLP metric message | |
| org.opentelemetry.otlp.logs.v1 | application/protobuf | Decode OTLP log message |
Pubsub subscription
The Google Cloud Pubsub receiver doesnāt automatically create subscriptions, it expects the subscription to be created upfront. Security wise itās best to give the collector its own service account and give the subscriptionPub/Sub Subscriber permission.
The subscription should also be of delivery type Pull.
Flow control
The flow control allows to fine tune the flow control settings for the subscription stream.trigger_ack_batch_duration(Optional): Part of the control loop, the time between each message acknowledge batch.stream_ack_deadline(Optional): The ack deadline to use for the stream. The minimum deadline you can specify is 10 seconds. The maximum deadline you can specify is 600 seconds (10 minutes).max_outstanding_messages(Optional): Flow control settings for the maximum number of outstanding messages. When there are max_outstanding_messages currently sent to the streaming pull client that have not yet been acked or nacked, the server stops sending more messages. The sending of messages resumes once the number of outstanding messages is less than this value. If the value is <= 0, there is no limit to the number of outstanding messages.max_outstanding_bytes(Optional): Flow control settings for the maximum number of outstanding bytes. When there are max_outstanding_bytes or more worth of messages currently sent to the streaming pull client that have not yet been acked or nacked, the server will stop sending more messages. The sending of messages resumes once the number of outstanding bytes is less than this value. If the value is <= 0, there is no limit to the number of outstanding bytes.
Filtering
When the messages on the subscription are accompanied by the correct attributes and you only need a specific type in your pipeline, the messages can be filtered on the subscription saving on egress fees. An example of filtering on trace message only:Configuration
Example Configuration
Last generated: 2026-04-13