Skip to main content
Deploy an OpenTelemetry (OTel) Collector to ingest telemetry from Google Cloud Platform (GCP) services and send it to Honeycomb. Analyzing your GCP telemetry with Honeycomb lets you answer questions like:
  • How did response time change after scaling up my Cloud Run services?
  • What is the error rate for my Pub/Sub topics?
  • How does application performance vary across GCP regions?
  • Are application errors happening in specific services, or across the entire environment?
  • Are there any performance bottlenecks in my Cloud SQL or Firestore operations?

Before you begin

Before you begin, make sure you have:

Choosing a collector distribution

Your first decision is which collector distribution to use: Use the following builder-config.yaml to build a custom collector with the GCP components you need:
extensions:
  - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/extension/encoding/googlecloudlogentryencodingextension v0.149.0
  - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/extension/googleclientauthextension v0.149.0

receivers:
  - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/googlecloudmonitoringreceiver v0.149.0
  - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/googlecloudpubsubreceiver v0.149.0
  - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/googlecloudspannerreceiver v0.149.0

providers:
  - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/confmap/provider/googlesecretmanagerprovider v0.149.0

Deploying an OpenTelemetry Collector

Deploy your collector in the same GCP environment as the services you want to monitor. This minimizes network latency and simplifies authentication using GCP’s built-in identity mechanisms. Google Cloud offers deployment guides for several environments. These guides focus on the Google-built OpenTelemetry Collector, but you can adapt them for other distributions. Follow the guide for your environment:

Collecting Google Cloud Run function metrics

The Google Cloud Monitoring Receiver pulls metrics from the Cloud Monitoring API on a schedule, making it useful for infrastructure-level data like instance counts, execution times, and memory usage. The receiver accepts a list of metric names; to explore available metrics, visit Google’s Cloud Monitoring documentation. This example configuration collects Google Cloud Run function metrics:
receivers:
  googlecloudmonitoring:
    collection_interval: 2m
    project_id: your-gcp-project-id
    metrics_list:
      - metric_name: "cloudfunctions.googleapis.com/function/active_instances"
      - metric_name: "cloudfunctions.googleapis.com/function/execution_count"
      - metric_name: "cloudfunctions.googleapis.com/function/execution_times"
      - metric_name: "cloudfunctions.googleapis.com/function/instance_count"
      - metric_name: "cloudfunctions.googleapis.com/function/network_egress"
      - metric_name: "cloudfunctions.googleapis.com/function/user_memory_bytes"
      - metric_name: "cloudfunctions.googleapis.com/pending_queue/pending_requests"
processors:
  batch: {}
exporters:
  otlp/honeycomb_metrics:
    endpoint: "api.honeycomb.io:443" # US instance
    #endpoint: "api.eu1.honeycomb.io:443" # EU instance
    headers:
      "x-honeycomb-team": "YOUR_API_KEY" # your Honeycomb Ingest API key
      # "x-honeycomb-dataset": "YOUR_DATASET_NAME" # optional
service:
  pipelines:
    metrics:
      receivers: [googlecloudmonitoring]
      processors: [batch]
      exporters: [otlp/honeycomb_metrics]

Collecting traces, logs, and metrics from Google Pub/Sub

Pub/Sub is a natural integration point for telemetry in GCP because many services can publish to a topic, and the receiver handles consuming and forwarding that data without additional configuration overhead. Use the Google Pub/Sub Receiver to collect telemetry from a Google Pub/Sub subscription. The following example configuration collects telemetry from a Pub/Sub subscription:
receivers:
  googlecloudpubsub:
    project: your-project
    subscription: projects/your-project/subscriptions/otlp-logs

Collecting database metrics from Google Cloud Spanner

The Spanner Receiver collects query and transaction metrics directly from Spanner’s built-in statistics tables, giving you visibility into slow queries, lock contention, and data volume without requiring application-level instrumentation. Use the Google Cloud Spanner Receiver to collect query, transaction, and other metrics from your databases. The following example configuration collects metrics from two Spanner instances across a single project:
receivers:
  googlecloudspanner:
    collection_interval: 60s
    initial_delay: 1s
    top_metrics_query_max_rows: 100
    backfill_enabled: true
    cardinality_total_limit: 200000
    hide_topn_lockstats_rowrangestartkey: false
    truncate_text: false
    projects:
      - project_id: "spanner project 1"
        service_account_key: "path to spanner project 1 service account json key"
        instances:
          - instance_id: "id1"
            databases:
              - "db11"
              - "db12"
          - instance_id: "id2"
            databases:
              - "db21"
              - "db22"

Exporting telemetry to Honeycomb

Once your receivers are configured, add an OTLP exporter to send your GCP telemetry to Honeycomb. Use the endpoint that matches the region where your Honeycomb data is stored. Configure an OTLP exporter with your Honeycomb Ingest API Key as a header:
exporters:
  otlp/honeycomb:
    endpoint: "api.honeycomb.io:443" # US instance
    #endpoint: "api.eu1.honeycomb.io:443" # EU instance
    headers:
      "x-honeycomb-team": "YOUR_API_KEY"
By default, Honeycomb routes telemetry to datasets based on the service name in your data. If you want to send specific signal types, such as metrics, to a dedicated dataset, add a second exporter with the x-honeycomb-dataset header:
exporters:
  otlp/honeycomb:
    endpoint: "api.honeycomb.io:443" # US instance
    #endpoint: "api.eu1.honeycomb.io:443" # EU instance
    headers:
      "x-honeycomb-team": "YOUR_API_KEY"
  otlp/honeycomb_metrics:
    endpoint: "api.honeycomb.io:443" # US instance
    #endpoint: "api.eu1.honeycomb.io:443" # EU instance
    headers:
      "x-honeycomb-team": "YOUR_API_KEY"
      "x-honeycomb-dataset": "YOUR_METRICS_DATASET"

Getting help

To ask questions and learn more, join our Pollinators Community Slack.