Menu

This is documentation for the next version of Grafana Alloy Documentation. For the latest stable release, go to the latest version.

Documentationbreadcrumb arrow Grafana Alloybreadcrumb arrow Referencebreadcrumb arrow Componentsbreadcrumb arrow otelcolbreadcrumb arrow otelcol.receiver.googlecloudpubsub
Experimental Open source Community

otelcol.receiver.googlecloudpubsub

Community: This component is developed, maintained, and supported by the Alloy user community. Grafana doesn’t offer commercial support for this component. To enable and use community components, you must set the --feature.community-components.enabled flag to true.

otelcol.receiver.googlecloudpubsub receives OpenTelemetry signals from a Google Cloud Pub/Sub subscription and forwards them to other otelcol.* components for processing or export.

Note

otelcol.receiver.googlecloudpubsub is a wrapper over the upstream OpenTelemetry Collector googlecloudpubsub receiver. Bug reports or feature requests will be redirected to the upstream repository, if necessary.

You can specify multiple otelcol.receiver.googlecloudpubsub components by giving them different labels.

Usage

alloy
otelcol.receiver.googlecloudpubsub "<LABEL>" {
  subscription = "projects/<PROJECT-ID>/subscriptions/<SUBSCRIPTION-NAME>"

  output {
    logs = [...]
    metrics = [...]
    trace = [...]
  }
}

Arguments

You can use the following arguments with otelcol.receiver.googlecloudpubsub:

NameTypeDescriptionDefaultRequired
subscriptionstringThe subscription name to receive OTLP data from. The subscription name should be a fully qualified resource name, for example: projects/otel-project/subscriptions/otlp.""yes
compressionstringThe compression used on data received from the subscription. Only gzip is supported. This is only used when no content-encoding attribute is present.""no
encodingstringThe encoding used to receive data from the subscription. This can either be otlp_proto_trace, otlp_proto_metric, otlp_proto_log or an encoding extension. This is only used when no media type attribute is present.""no
endpointstringOverride the default Pub/Sub endpoint. This is useful when connecting to the Pub/Sub emulator instance or switching between global and regional service endpoints.""no
ignore_encoding_errorboolIgnore errors when the configured encoder fails to decode Pub/Sub messages. Ignoring the error causes the receiver to drop the message.falseno
insecureboolAllows performing insecure SSL connections and transfers. This is useful when connecting to a local emulator instance. Only has effect if you set endpoint.falseno
projectstringThe Google Cloud Project project identifier.""no
timeoutDurationTimeout for calls to the Pub/Sub API."12s"no

Blocks

You can use the following blocks with otelcol.receiver.googlecloudpubsub:

BlockDescriptionRequired
outputConfigures where to send received telemetry data.yes
debug_metricsConfigures the metrics that this component generates to monitor its state.no

output

Required

The output block configures a set of components to forward resulting telemetry data to.

The following arguments are supported:

NameTypeDescriptionDefaultRequired
logslist(otelcol.Consumer)List of consumers to send logs to.[]no
metricslist(otelcol.Consumer)List of consumers to send metrics to.[]no
traceslist(otelcol.Consumer)List of consumers to send traces to.[]no

You must specify the output block, but all its arguments are optional. By default, telemetry data is dropped. Configure the metrics, logs, and traces arguments accordingly to send telemetry data to other components.

debug_metrics

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

The following arguments are supported:

NameTypeDescriptionDefaultRequired
disable_high_cardinality_metricsbooleanWhether to disable certain high cardinality metrics.trueno

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

otelcol.receiver.googlecloudpubsub doesn’t export any fields.

Component health

otelcol.receiver.googlecloudpubsub is only reported as unhealthy if given an invalid configuration.

Debug information

otelcol.receiver.googlecloudpubsub doesn’t expose any component-specific debug information.

Example

The following example collects signals from Google Cloud Pub/Sub subscription and forwards logs through a batch processor:

alloy
otelcol.receiver.googlecloudpubsub "default" {
  subscription = "projects/my-gcp-project/subscriptions/my-pubsub-subscription"

  output {
    logs = [otelcol.processor.batch.default.input]
  }
}

otelcol.processor.batch "default" {
  output {
    logs = [otelcol.exporter.otlp.default.input]
  }
}

otelcol.exporter.otlp "default" {
  client {
    endpoint = env("<OTLP_ENDPOINT>")
  }
}

Compatible components

otelcol.receiver.googlecloudpubsub can accept arguments from the following components:

otelcol.receiver.googlecloudpubsub has exports that can be consumed by the following components:

Note

Connecting some components may not be sensible or components may require further configuration to make the connection work correctly. Refer to the linked documentation for more details.