---
title: "otelcol.auth.google | Grafana Alloy documentation"
description: "Learn about otelcol.auth.google"
---

# `otelcol.auth.google`

> **Public preview**: This is a [public preview](/docs/release-life-cycle/) component. Public preview components are subject to breaking changes, and may be replaced with equivalent functionality that cover the same use case. To enable and use a public preview component, you must set the `stability.level` [flag](/docs/alloy/latest/reference/cli/run/) to `public-preview` or below.

`otelcol.auth.google` exposes a `handler` that other `otelcol` components can use to authenticate requests using Google Application Default Credentials.

This component only supports client authentication.

The authorization tokens can be used by HTTP and gRPC based OpenTelemetry exporters. This component can fetch and refresh expired tokens automatically. Refer to the [Google Cloud Documentation](https://docs.cloud.google.com/docs/authentication/application-default-credentials) for more information about Application Default Credentials.

> Note
> 
> `otelcol.auth.google` is a wrapper over the upstream OpenTelemetry Collector [`googleclientauth`](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/v0.147.0/extension/googleclientauthextension) extension. Bug reports or feature requests will be redirected to the upstream repository, if necessary.

You can specify multiple `otelcol.auth.google` components by giving them different labels.

## Usage

Alloy ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```alloy
otelcol.auth.google "<LABEL>" {
    project     = "<PROJECT_ID>"
}
```

## Arguments

You can use the following arguments with `otelcol.auth.google`:

Expand table

| Name            | Type           | Description                                                        | Default        | Required |
|-----------------|----------------|--------------------------------------------------------------------|----------------|----------|
| `audience`      | `string`       | The audience claim used for generating an ID token.                |                | no       |
| `project`       | `string`       | The project telemetry is sent to.                                  |                | no       |
| `quota_project` | `string`       | A project for quota and billing purposes.                          |                | no       |
| `scopes`        | `list(string)` | Requested permissions associated with the client.                  | `[]`           | no       |
| `token_type`    | `string`       | The type of token to generate. One of `access_token` or `id_token` | `access_token` | no       |

If `project` isn’t set, Alloy uses the project from the Application Default Credentials.

## Blocks

You can use the following blocks with `otelcol.auth.google`:

Expand table

| Block                             | Description                                                                | Required |
|-----------------------------------|----------------------------------------------------------------------------|----------|
| [`debug_metrics`](#debug_metrics) | Configures the metrics that this component generates to monitor its state. | no       |

### `debug_metrics`

The `debug_metrics` block configures the metrics that this component generates to monitor its state.

The following arguments are supported:

Expand table

| Name                               | Type      | Description                                          | Default | Required |
|------------------------------------|-----------|------------------------------------------------------|---------|----------|
| `disable_high_cardinality_metrics` | `boolean` | Whether to disable certain high cardinality metrics. | `true`  | no       |

`disable_high_cardinality_metrics` is the Alloy equivalent to the `telemetry.disableHighCardinalityMetrics` feature gate in the OpenTelemetry Collector. It removes attributes that could cause high cardinality metrics. For example, attributes with IP addresses and port numbers in metrics about HTTP and gRPC connections are removed.

> Note
> 
> If configured, `disable_high_cardinality_metrics` only applies to `otelcol.exporter.*` and `otelcol.receiver.*` components.

## Exported fields

The following fields are exported and can be referenced by other components:

Expand table

| Name      | Type                       | Description                                                     |
|-----------|----------------------------|-----------------------------------------------------------------|
| `handler` | `capsule(otelcol.Handler)` | A value that other components can use to authenticate requests. |

## Component health

`otelcol.auth.google` is only reported as unhealthy if given an invalid configuration.

## Debug information

`otelcol.auth.google` doesn’t expose any component-specific debug information.

## Example

This example configures [`otelcol.exporter.otlp`](../otelcol.exporter.otlp/) to use `otelcol.auth.google` for authentication:

Alloy ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```alloy
otelcol.exporter.otlp "google" {
  client {
    endpoint = "telemetry.googleapis.com"
    auth     = otelcol.auth.google.creds.handler
  }
}

otelcol.auth.google "creds" {
    project = "myproject"
}
```
