---
title: Google Cloud Pubsub
description: >-
  A scalable, flexible, and reliable enterprise message-oriented middleware
  solution in Google Cloud.
breadcrumbs: Docs > Integrations > Google Cloud Pubsub
---

# Google Cloud Pubsub

## Overview{% #overview %}

Google Cloud Pub/Sub brings the scalability, flexibility, and reliability of enterprise message-oriented middleware to the cloud.

Get metrics from Google Pub/Sub to:

- Visualize the performance of your Pub/Sub topics and subscriptions.
- Correlate the performance of your Pub/Sub topics and subscriptions with your applications.

## Setup{% #setup %}

### Metric collection{% #metric-collection %}

#### Installation{% #installation %}

If you haven't already, set up the [Google Cloud Platform integration](https://docs.datadoghq.com/integrations/google-cloud-platform.md) first. There are no other installation steps.

#### Configuration{% #configuration %}

To collect custom Pub/Sub labels as tags, enable the cloud asset inventory permission on the Datadog service account in Google Cloud.

### Log collection{% #log-collection %}

Google Cloud Pub/Sub logs are collected with Google Cloud Logging and sent to a Dataflow job through a Cloud Pub/Sub topic. If you haven't already, [set up logging with the Datadog Dataflow template](https://docs.datadoghq.com/integrations/google-cloud-platform.md#log-collection).

Once this is done, export your Google Cloud Pub/Sub logs from Google Cloud Logging to the Pub/Sub topic:

1. Go to the [Google Cloud Logging page](https://console.cloud.google.com/logs/viewer) and filter the Google Cloud Pub/Sub logs.
1. Click **Create Sink** and name the sink accordingly.
1. Choose "Cloud Pub/Sub" as the destination and select the Pub/Sub topic that was created for that purpose. **Note**: The Pub/Sub topic can be located in a different project.
1. Click **Create** and wait for the confirmation message to show up.

## Data Collected{% #data-collected %}

### Metrics{% #metrics %}

|  |
|  |
| **gcp.pubsub.snapshot.backlog\_bytes**(gauge)                                          | Total byte size of the messages retained in a snapshot.*Shown as byte*                                                                                                                                                                                                                                                   |
| **gcp.pubsub.snapshot.backlog\_bytes\_by\_region**(gauge)                              | Total byte size of the messages retained in a snapshot, broken down by Cloud region.*Shown as byte*                                                                                                                                                                                                                      |
| **gcp.pubsub.snapshot.config\_updates\_count**(count)                                  | Cumulative count of configuration changes, grouped by operation type and result.*Shown as update*                                                                                                                                                                                                                        |
| **gcp.pubsub.snapshot.num\_messages**(gauge)                                           | Number of messages retained in a snapshot.*Shown as message*                                                                                                                                                                                                                                                             |
| **gcp.pubsub.snapshot.num\_messages\_by\_region**(gauge)                               | Number of messages retained in a snapshot, broken down by Cloud region.*Shown as message*                                                                                                                                                                                                                                |
| **gcp.pubsub.snapshot.oldest\_message\_age**(gauge)                                    | Age (in seconds) of the oldest message retained in a snapshot.*Shown as second*                                                                                                                                                                                                                                          |
| **gcp.pubsub.snapshot.oldest\_message\_age\_by\_region**(gauge)                        | Age (in seconds) of the oldest message retained in a snapshot, broken down by Cloud region.*Shown as second*                                                                                                                                                                                                             |
| **gcp.pubsub.subscription.ack\_latencies.avg**(gauge)                                  | Average of ack latencies.*Shown as millisecond*                                                                                                                                                                                                                                                                          |
| **gcp.pubsub.subscription.ack\_latencies.samplecount**(count)                          | Sample Count for ack latencies.*Shown as millisecond*                                                                                                                                                                                                                                                                    |
| **gcp.pubsub.subscription.ack\_latencies.sumsqdev**(gauge)                             | Sum of Squared Deviation for ack latencies.*Shown as millisecond*                                                                                                                                                                                                                                                        |
| **gcp.pubsub.subscription.ack\_message\_count**(count)                                 | Cumulative count of messages acknowledged by Acknowledge requests, grouped by delivery type.*Shown as message*                                                                                                                                                                                                           |
| **gcp.pubsub.subscription.backlog\_bytes**(gauge)                                      | Total byte size of the unacknowledged messages (also known as backlog messages) in a subscription.*Shown as byte*                                                                                                                                                                                                        |
| **gcp.pubsub.subscription.billable\_bytes\_by\_region**(gauge)                         | Total byte size of the billable messages in a subscription, broken down by Cloud region and type. See the [Pub/Sub pricing page](https://cloud.google.com/pubsub/pricing#storage_costs) for more information about pricing for retaining unacknowledged messages in subscriptions for more than 24 hours.*Shown as byte* |
| **gcp.pubsub.subscription.byte\_cost**(count)                                          | Cost of operations per subscription measured.*Shown as byte*                                                                                                                                                                                                                                                             |
| **gcp.pubsub.subscription.config\_updates\_count**(count)                              | Number of configuration changes for subscriptions.*Shown as occurrence*                                                                                                                                                                                                                                                  |
| **gcp.pubsub.subscription.dead\_letter\_message\_count**(count)                        | Cumulative count of messages published to dead letter topic.*Shown as message*                                                                                                                                                                                                                                           |
| **gcp.pubsub.subscription.delivery\_latency\_health\_score**(gauge)                    | A score that measures the health of a subscription.*Shown as occurrence*                                                                                                                                                                                                                                                 |
| **gcp.pubsub.subscription.exactly\_once\_warning\_count**(count)                       | Count of instances (acks and modacks that may have failed) that may lead to message redeliveries.*Shown as occurrence*                                                                                                                                                                                                   |
| **gcp.pubsub.subscription.expired\_ack\_deadlines\_count**(count)                      | Cumulative count of messages whose ack deadline expired while the messages was outstanding to a subscriber client.*Shown as message*                                                                                                                                                                                     |
| **gcp.pubsub.subscription.export\_push\_subscription\_details**(gauge)                 | Type and state of the export push subscription.                                                                                                                                                                                                                                                                          |
| **gcp.pubsub.subscription.mod\_ack\_deadline\_message\_count**(count)                  | Cumulative count of messages whose deadline was updated by ModifyAckDeadline requests.*Shown as message*                                                                                                                                                                                                                 |
| **gcp.pubsub.subscription.mod\_ack\_deadline\_request\_count**(count)                  | Number of ModifyAckDeadline requests.*Shown as request*                                                                                                                                                                                                                                                                  |
| **gcp.pubsub.subscription.mod\_ack\_latencies.avg**(count)                             | The average distribution of ModAck latencies. For each message delivery attempt, the ModAck latency is the duration between when the CPS service delivers the message to a subscriber client and when the CPS service receives a ModAck request for that message.*Shown as millisecond*                                  |
| **gcp.pubsub.subscription.mod\_ack\_latencies.samplecount**(count)                     | The sample count for distribution of ModAck latencies. For each message delivery attempt, the ModAck latency is the duration between when the CPS service delivers the message to a subscriber client and when the CPS service receives a ModAck request for that message.*Shown as millisecond*                         |
| **gcp.pubsub.subscription.mod\_ack\_latencies.sumsqdev**(count)                        | The sum of squared deviation for distribution of ModAck latencies. For each message delivery attempt, the ModAck latency is the duration between when the CPS service delivers the message to a subscriber client and when the CPS service receives a ModAck request for that message.*Shown as millisecond*             |
| **gcp.pubsub.subscription.nack\_requests**(gauge)                                      | Cumulative count of messages that were nacked. One message nacked multiple times will be counted multiple times.                                                                                                                                                                                                         |
| **gcp.pubsub.subscription.num\_outstanding\_messages**(gauge)                          | Messages delivered but not yet acknowledged.*Shown as message*                                                                                                                                                                                                                                                           |
| **gcp.pubsub.subscription.num\_retained\_acked\_messages**(gauge)                      | Number of acknowledged messages retained in a subscription.*Shown as message*                                                                                                                                                                                                                                            |
| **gcp.pubsub.subscription.num\_retained\_acked\_messages\_by\_region**(gauge)          | Number of acknowledged messages retained in a subscription, broken down by Cloud region.*Shown as message*                                                                                                                                                                                                               |
| **gcp.pubsub.subscription.num\_unacked\_messages\_by\_region**(gauge)                  | Number of unacknowledged messages in a subscription, broken down by Cloud region.*Shown as message*                                                                                                                                                                                                                      |
| **gcp.pubsub.subscription.num\_undelivered\_messages**(gauge)                          | Number of unacknowledged messages (also known as backlog messages) in a subscription.                                                                                                                                                                                                                                    |
| **gcp.pubsub.subscription.oldest\_retained\_acked\_message\_age**(gauge)               | Age (in seconds) of the oldest acknowledged message retained in a subscription.*Shown as second*                                                                                                                                                                                                                         |
| **gcp.pubsub.subscription.oldest\_retained\_acked\_message\_age\_by\_region**(gauge)   | Age (in seconds) of the oldest acknowledged message retained in a subscription, broken down by Cloud region.*Shown as second*                                                                                                                                                                                            |
| **gcp.pubsub.subscription.oldest\_unacked\_message\_age**(gauge)                       | Age (in seconds) of the oldest unacknowledged message (also known as a backlog message) in a subscription.*Shown as second*                                                                                                                                                                                              |
| **gcp.pubsub.subscription.oldest\_unacked\_message\_age\_by\_region**(gauge)           | Age (in seconds) of the oldest unacknowledged message in a subscription, broken down by Cloud region.*Shown as second*                                                                                                                                                                                                   |
| **gcp.pubsub.subscription.open\_streaming\_pulls**(gauge)                              | Number of open StreamingPull streams per subscription, grouped by status.                                                                                                                                                                                                                                                |
| **gcp.pubsub.subscription.pull\_ack\_request\_count**(count)                           | Delta count of message pull acknowledgement requests.*Shown as request*                                                                                                                                                                                                                                                  |
| **gcp.pubsub.subscription.pull\_request\_count**(count)                                | Number of message pull requests.*Shown as request*                                                                                                                                                                                                                                                                       |
| **gcp.pubsub.subscription.push\_request\_count**(count)                                | Number of message push attempts.*Shown as request*                                                                                                                                                                                                                                                                       |
| **gcp.pubsub.subscription.push\_request\_latencies.avg**(gauge)                        | Average of push request latencies.*Shown as microsecond*                                                                                                                                                                                                                                                                 |
| **gcp.pubsub.subscription.push\_request\_latencies.samplecount**(count)                | Sample Count for push request latencies.*Shown as microsecond*                                                                                                                                                                                                                                                           |
| **gcp.pubsub.subscription.push\_request\_latencies.sumsqdev**(gauge)                   | Sum of Squared Deviation for push request latencies.*Shown as microsecond*                                                                                                                                                                                                                                               |
| **gcp.pubsub.subscription.retained\_acked\_bytes**(gauge)                              | Total byte size of the acknowledged messages retained in a subscription.*Shown as byte*                                                                                                                                                                                                                                  |
| **gcp.pubsub.subscription.retained\_acked\_bytes\_by\_region**(gauge)                  | Total byte size of the acknowledged messages retained in a subscription, broken down by Cloud region.*Shown as byte*                                                                                                                                                                                                     |
| **gcp.pubsub.subscription.seek\_request\_count**(count)                                | Cumulative count of seek attempts, grouped by result.*Shown as request*                                                                                                                                                                                                                                                  |
| **gcp.pubsub.subscription.sent\_message\_count**(count)                                | Cumulative count of messages sent by Cloud Pub/Sub to subscriber clients.*Shown as message*                                                                                                                                                                                                                              |
| **gcp.pubsub.subscription.streaming\_pull\_ack\_request\_count**(count)                | Cumulative count of streaming pull requests with non-empty acknowledge IDs, grouped by result.*Shown as request*                                                                                                                                                                                                         |
| **gcp.pubsub.subscription.streaming\_pull\_mod\_ack\_deadline\_request\_count**(count) | Cumulative count of streaming pull requests with non-empty ModifyAckDeadline fields, grouped by result.*Shown as request*                                                                                                                                                                                                |
| **gcp.pubsub.subscription.streaming\_pull\_response\_count**(count)                    | Cumulative count of streaming pull responses, grouped by result.*Shown as response*                                                                                                                                                                                                                                      |
| **gcp.pubsub.subscription.unacked\_bytes\_by\_region**(gauge)                          | Total byte size of the unacknowledged messages in a subscription, broken down by Cloud region.*Shown as byte*                                                                                                                                                                                                            |
| **gcp.pubsub.topic.byte\_cost**(count)                                                 | Byte cost of operations per topic.*Shown as byte*                                                                                                                                                                                                                                                                        |
| **gcp.pubsub.topic.config\_updates\_count**(count)                                     | Number of configuration changes for topics.*Shown as occurrence*                                                                                                                                                                                                                                                         |
| **gcp.pubsub.topic.ingestion\_byte\_count**(count)                                     | Byte count of ingested messages per ingestion source type and import partition (for example, AWS Kinesis shard ID).*Shown as byte*                                                                                                                                                                                       |
| **gcp.pubsub.topic.ingestion\_data\_source\_state**(gauge)                             | State of the ingestion data source per ingestion source type.                                                                                                                                                                                                                                                            |
| **gcp.pubsub.topic.ingestion\_failure\_count**(count)                                  | Number of errors encountered when ingesting data per ingestion source type, source name, import partition, and reason for error.                                                                                                                                                                                         |
| **gcp.pubsub.topic.ingestion\_message\_count**(count)                                  | Number of ingested messages per ingestion source type and import partition (for example, AWS Kinesis shard ID).                                                                                                                                                                                                          |
| **gcp.pubsub.topic.message\_sizes.avg**(gauge)                                         | Average of publish message sizes.*Shown as byte*                                                                                                                                                                                                                                                                         |
| **gcp.pubsub.topic.message\_sizes.samplecount**(count)                                 | Sample Count for publish message sizes.*Shown as byte*                                                                                                                                                                                                                                                                   |
| **gcp.pubsub.topic.message\_sizes.sumsqdev**(gauge)                                    | Sum of Squared Deviation for publish message sizes.*Shown as byte*                                                                                                                                                                                                                                                       |
| **gcp.pubsub.topic.num\_retained\_acked\_messages\_by\_region**(gauge)                 | Number of acknowledged messages retained in a topic, broken down by Cloud region.*Shown as message*                                                                                                                                                                                                                      |
| **gcp.pubsub.topic.num\_retained\_messages**(gauge)                                    | Number of messages retained in a topic.*Shown as message*                                                                                                                                                                                                                                                                |
| **gcp.pubsub.topic.num\_unacked\_messages\_by\_region**(gauge)                         | Number of unacknowledged messages in a topic, broken down by Cloud region.*Shown as message*                                                                                                                                                                                                                             |
| **gcp.pubsub.topic.oldest\_retained\_acked\_message\_age\_by\_region**(gauge)          | Age (in seconds) of the oldest acknowledged message retained in a topic, broken down by Cloud region.*Shown as second*                                                                                                                                                                                                   |
| **gcp.pubsub.topic.oldest\_retained\_message\_age**(gauge)                             | Age (in seconds) of the oldest message retained in a topic.*Shown as second*                                                                                                                                                                                                                                             |
| **gcp.pubsub.topic.oldest\_unacked\_message\_age\_by\_region**(gauge)                  | Age (in seconds) of the oldest unacknowledged message in a topic, broken down by Cloud region.*Shown as second*                                                                                                                                                                                                          |
| **gcp.pubsub.topic.retained\_acked\_bytes\_by\_region**(gauge)                         | Total byte size of the acknowledged messages retained in a topic, broken down by Cloud region.*Shown as byte*                                                                                                                                                                                                            |
| **gcp.pubsub.topic.retained\_bytes**(gauge)                                            | Total byte size of the messages retained in a topic.*Shown as byte*                                                                                                                                                                                                                                                      |
| **gcp.pubsub.topic.schema\_validation\_latencies.avg**(count)                          | The average distribution of schema validation latencies in milliseconds.*Shown as millisecond*                                                                                                                                                                                                                           |
| **gcp.pubsub.topic.schema\_validation\_latencies.samplecount**(count)                  | The sample count for distribution of schema validation latencies in milliseconds.*Shown as millisecond*                                                                                                                                                                                                                  |
| **gcp.pubsub.topic.schema\_validation\_latencies.sumsqdev**(count)                     | The sum of squared deviation for distribution of schema validation latencies in milliseconds.*Shown as millisecond*                                                                                                                                                                                                      |
| **gcp.pubsub.topic.send\_request\_count**(count)                                       | Number of message send requests.*Shown as request*                                                                                                                                                                                                                                                                       |
| **gcp.pubsub.topic.send\_request\_latencies.avg**(gauge)                               | Average of topic send request latencies.*Shown as microsecond*                                                                                                                                                                                                                                                           |
| **gcp.pubsub.topic.send\_request\_latencies.samplecount**(count)                       | Sample Count for topic send request latencies.*Shown as microsecond*                                                                                                                                                                                                                                                     |
| **gcp.pubsub.topic.send\_request\_latencies.sumsqdev**(gauge)                          | Sum of Squared Deviation for topic send request latencies.*Shown as microsecond*                                                                                                                                                                                                                                         |
| **gcp.pubsub.topic.unacked\_bytes\_by\_region**(gauge)                                 | Total byte size of the unacknowledged messages in a topic, broken down by Cloud region.*Shown as byte*                                                                                                                                                                                                                   |

### Events{% #events %}

The Google Cloud Pub/Sub integration does not include any events.

### Service Checks{% #service-checks %}

The Google Cloud Pub/Sub integration does not include any service checks.

## Troubleshooting{% #troubleshooting %}

Need help? Contact [Datadog support](https://docs.datadoghq.com/help/).
