---
title: GCP Cloud Monitoring (formerly Stackdriver)
slug: telemetry-pipeline/gcp-cloud-monitoring-formerly-stackdriver
docTags: 
createdAt: 2025-04-21T00:59:07.704Z
---

# GCP Cloud Monitoring Sink

## Overview

The **GCP Cloud Monitoring (formerly Stackdriver) metrics sink** delivers **metric events** to **Google Cloud Monitoring** (Metrics API).
&#x20;Use it when you want your worker-emitted metrics to appear as **Cloud Monitoring time series**, so you can build dashboards, alerts, SLOs, and integrate with the broader Cloud Operations suite.

## Supported Input Types

- Metrics&#x20;

## Authentication

You can authenticate in one of these ways:

- **Service account JSON file** via credentials\_path&#x20;
- **API key** via api\_key&#x20;
- **Application Default Credentials (ADC)** (implicit auth):&#x20;
  - uses GOOGLE\_APPLICATION\_CREDENTIALS if set&#x20;
  - otherwise, tries instance metadata credentials when running on GCE/GKE with a service account&#x20;

If you don’t explicitly set api\_key or credentials\_path, ADC is the fallback.

## Required Configuration

### project\_id (required)

The **GCP project ID** that will own the published metrics (time series are written into this project).

### resource (required)

Defines the **monitored resource** that the time series will be associated with.

- resource.type (required): the monitored resource type (e.g., gce\_instance, k8s\_container, global, etc.)&#x20;
- resource.\* (required): label values required by that resource type (e.g., for gce\_instance: projectId, instanceId, zone)&#x20;

This matters because Cloud Monitoring organizes and queries metrics heavily via resource metadata. If your resource labels don’t match the type’s descriptor, writes will fail.



## Namespacing

### default\_namespace (optional)

Cloud Monitoring can differentiate metrics by **namespace**.
&#x20;If a metric event does not already include a namespace, worker will apply:

- default\_namespace (default: namespace)&#x20;

This prevents collisions when different metric producers share the same metric name.

## Delivery and Reliability Controls

### acknowledgements (optional)

Controls end-to-end acknowledgements at the sink level.

- acknowledgements.enabled: when enabled, sources that support E2E acks wait until this sink confirms delivery before acknowledging upstream.&#x20;

This is important when you want “don’t ack unless it’s safely delivered” semantics across the pipeline.

### batch (optional)

Controls how metric events are grouped before sending.

- batch.max\_events (default: **1 event**)&#x20;
- batch.timeout\_secs (default: **1 second**)&#x20;

Because the default is effectively “send immediately”, you’ll get low latency but potentially higher request volume. Increasing batch sizes can improve throughput and reduce API calls, at the expense of latency.

### buffer (optional)

Controls buffering when the sink cannot keep up temporarily.

- buffer.type: memory (default) or disk&#x20;
- buffer.max\_size: required (and if disk, must be >= \~256MB)&#x20;
- buffer.when\_full: block (default) or drop\_newest&#x20;

Guidance:

- **memory + block** is typical for “don’t drop data, apply backpressure”&#x20;
- **disk** helps survive restarts or temporary outages without losing buffered metrics&#x20;

## Request / Networking Controls

### proxy (optional)

HTTP(S) proxy support (including no\_proxy) for outbound requests to Google APIs.

### request (optional)

Advanced outbound behavior:

- request.concurrency: adaptive (default) or fixed / none&#x20;
- rate limiting (rate\_limit\_num, rate\_limit\_duration\_secs)&#x20;
- retries (retry\_attempts, backoff, jitter)&#x20;
- timeouts (timeout\_secs)&#x20;

This is where you tune for:

- quota limits,&#x20;
- high-volume emission,&#x20;
- resilience against transient API failures.&#x20;

## TLS

### tls (optional)

Standard TLS controls:

- custom CA (ca\_file)&#x20;
- client certs (crt\_file, key\_file)&#x20;
- verification toggles (verify\_certificate, verify\_hostname)&#x20;

Keep verification enabled unless you have a controlled internal interception setup and fully understand the risk.

## Operational Notes

- **This sink is beta**, so expect occasional behavior changes and be ready to pin/test worker's versions in production.&#x20;
- Cloud Monitoring enforces constraints on time series writes (resource typing/labels, descriptor compatibility, quotas). If you see rejects, it’s usually **resource label mismatch**, **quota**, or **metric descriptor conflicts** (namespacing helps here).
