# StatsD

Copy as Markdown[Open in ChatGPT](https://chatgpt.com/?q=Read%20https%3A%2F%2Fcoralogix.com%2Fdocs%2Fintegrations%2Fmetrics%2Fstatsd.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)[Open in Claude](https://claude.ai/new?q=Read%20https%3A%2F%2Fcoralogix.com%2Fdocs%2Fintegrations%2Fmetrics%2Fstatsd.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)

StatsD is an open-source standard and, by extension, a toolkit designed for sending, collecting, and aggregating custom metrics from diverse applications. Initially, StatsD denoted a daemon crafted by Etsy using Node.js.

This tutorial demonstrates installing and running StatsD using OpenTelemetry to send your metrics to Coralogix.

## Prerequisites[​](#prerequisites "Direct link to Prerequisites")

* Otel-contrib installed

* Coralogix account

## Deploy using Otel[​](#deploy-using-otel "Direct link to Deploy using Otel")

**STEP 1**. Save this config file as `config.yaml`:

```
receivers:

  statsd:

    endpoint: "localhost:8125"

    aggregation_interval: 30s

    

processors:

  batch:

    send_batch_size: 1024

    send_batch_max_size: 2048

    timeout: "1s"

  

exporters:

  coralogix:

    domain: "eu2.coralogix.com"

    private_key: "<private_key>"

    application_name: "applicationName"

    subsystem_name: "subsystemName"

    timeout: 30s

  

service:

  pipelines:

    metrics:

      receivers: [ statsd ]

      processors: [ batch ] 

      exporters: [ coralogix ]
```

> **STEP 2**. Replace the `private_key` with your [Send-Your-Data API key](https://coralogix.com/docs/docs/user-guides/account-management/api-keys/send-your-data-api-key/.md), and the `coralogix_domain` with your [Coralogix domain](https://coralogix.com/docs/docs/user-guides/account-management/account-settings/coralogix-domain/.md).
>
> **STEP 3**. Run the config file.

```
otelcol-contrib --config config.yaml
```

## Deploy using Docker[​](#deploy-using-docker "Direct link to Deploy using Docker")

**STEP 1**. To deploy StatsD using Docker, change the endpoint to `0.0.0.0:8125` in the `config.yaml` file.

```
receivers:

  statsd:

    endpoint: "0.0.0.0:8125"
```

**STEP 2**. Run these commands to deploy the configuration:

```
docker pull otel/opentelemetry-collector-contrib

docker run -d -v ./config.yaml:/etc/otelcol-contrib/config.yaml -p 8125:8125/udp otel/opentelemetry-collector-contrib
```

## Validation[​](#validation "Direct link to Validation")

### Test Metrics[​](#test-metrics "Direct link to Test Metrics")

To send test metrics, run the following command to test the configuration:

```
echo "test_metrics:65|c|#tag_1:value,tag_2:value_2" | nc -u -w1 127.0.0.1 8125

echo "test_metrics:65|g|#tag_1:value,tag_2:value_2" | nc -u -w1 127.0.0.1 8125
```

Access your Grafana account to view the metrics sent.

[![](/docs/assets/images/image-2-f44211a7fc87cb63f4755b5fe09adbb9.webp)](https://coralogix.com/docs/docs/assets/images/image-2-f44211a7fc87cb63f4755b5fe09adbb9.webp)

### Timer Metrics[​](#timer-metrics "Direct link to Timer Metrics")

Send timer metrics to Coralogix with sum and count attributes:

```
receivers:

  statsd:

    endpoint: "0.0.0.0:8125"

    is_monotonic_counter: true

    aggregation_interval: 30s

    enable_metric_type: true

    timer_histogram_mapping:

      - statsd_type: "timer"

        observer_type: "summary"
```

To send metrics, use this command:

```
echo "timer_metrics:65|ms|#tag_1:value,tag_2:value_2" | nc -u -w1 127.0.0.1 8125
```

View more configuration options for the StatsD receiver [here](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/statsdreceiver/README.md).
