The OpenTelemetry Collector, when configured with a StatsD receiver, provides an integration with Gunicorn to receive StatsD metrics. The Collector uses the StatsD Receiver to receive metrics from the configured endpoint in the Gunicorn configuration file. From there, the metrics are processed and exported to Cloud Observability.

To complete the integration, you will:

  • Configure Gunicorn to use the StatsD endpoint.
  • Configure the Collector StatsD endpoint to host for the StatsD receiver.
  • Enable the integration by adding it to a pipeline.


  • You have a intermediate understanding of StatsD metrics.
  • You’ve configured the Collector to export metric data to Cloud Observability.

Configure Gunicorn reporting

You need to configure Gunicorn to use the StatsD exporter.

Run your Gunicorn server with --statsd-host argument like the following example:

gunicorn --bind main:app --statsd-host otel-collector:8125

Configure the Collector receiver

Gunicorn emits metrics through custom StatsD format. Emitted metrics are broadcasted from StatsD using UDP on the StatsD default port 8125.

In the Collector configuration file, configure the StatsD receiver to host StatsD endpoint to receive metrics.

    endpoint: "otel-collector:8125"
    aggregation_interval: 70s
    enable_metric_type: true
    is_monotonic_counter: false
      - statsd_type: "histogram"
        observer_type: "summary"
      - statsd_type: "timing"

The OpenTelemetry repo provides additional details about StatsD receiver configuration.

More details about the StatsD configuration can be found here.

Enable the Collector receiver

Once the Gunicorn receiver is configured, enable it by adding it to one or more pipelines as described in the Collector configuration documentation.

Validate metrics are reporting to Cloud Observability

You can validate that metrics are reporting to Cloud Observability on the Metrics details page in Settings.

  1. In Cloud Observability, click Settings > Metric details.

  2. Search for Gunicorn metric names. Search for metric

  3. If needed, click on the metric to edit the description and how the units are displayed in Cloud Observability.

Create a dashboard for the metrics

Use the Cloud Observability Terraform Provider to create a dashboard for the metrics.

Additional resources

For a more complete example that’s ready to run, see the Gunicorn integration in Cloud Observability OpenTelemetry Examples.

See also

Create and manage dashboards

Create alerts

Updated Dec 20, 2022