---
title: DogStatsD
description: Overview of the features of DogStatsD, including data types and tagging.
breadcrumbs: Docs > Extend Datadog > DogStatsD
---

# DogStatsD

The easiest way to get your custom application metrics into Datadog is to send them to DogStatsD, a metrics aggregation service bundled with the Datadog Agent. DogStatsD implements the [StatsD](https://github.com/statsd/statsd) protocol and adds a few Datadog-specific extensions:

- Histogram metric type
- Service checks
- Events
- Tagging

Any compliant StatsD client works with DogStatsD and the Agent, but does not include the Datadog-specific extensions.

**Note**: DogStatsD does NOT implement timers from StatsD as a native metric type (though it does support them through [histograms](https://docs.datadoghq.com/metrics/custom_metrics/dogstatsd_metrics_submission.md)).

DogStatsD is available on the Datadog Container Registry, GAR, ECR, Azure ACR, and Docker Hub:

| Registry                   | Image                                                                                     |
| -------------------------- | ----------------------------------------------------------------------------------------- |
| Datadog Container Registry | [registry.datadoghq.com/dogstatsd](https://registry.datadoghq.com/v2/dogstatsd/tags/list) |
| Google Artifact Registry   | [gcr.io/datadoghq/dogstatsd](https://gcr.io/datadoghq/dogstatsd)                          |
| Amazon ECR                 | [public.ecr.aws/datadog/dogstatsd](https://gallery.ecr.aws/datadog/dogstatsd)             |
| Azure ACR                  | datadoghq.azurecr.io/dogstatsd                                                            |
| Docker Hub                 | [hub.docker.com/r/datadog/dogstatsd](https://hub.docker.com/r/datadog/dogstatsd)          |

{% alert level="warning" %}
Docker Hub is subject to image pull rate limits. If you are not a Docker Hub customer, Datadog recommends that you use the Datadog Container Registry or a cloud-provider registry instead. For instructions, see [Changing your container registry](https://docs.datadoghq.com/agent/guide/changing_container_registry.md).
{% /alert %}

## How it works{% #how-it-works %}

DogStatsD accepts [custom metrics](https://docs.datadoghq.com/metrics/custom_metrics.md), [events](https://docs.datadoghq.com/events/guides/dogstatsd.md), and [service checks](https://docs.datadoghq.com/extend/service_checks/dogstatsd_service_checks_submission.md) over UDP and periodically aggregates and forwards them to Datadog.

Because it uses UDP, your application can send metrics to DogStatsD and resume its work without waiting for a response. If DogStatsD ever becomes unavailable, your application doesn't experience an interruption.

{% image
   source="https://docs.dd-static.net/images/metrics/custom_metrics/dogstatsd_metrics_submission/dogstatsd.5466e01450a2cc9c0fe3382e068caaf8.png?auto=format&fit=max&w=850 1x, https://docs.dd-static.net/images/metrics/custom_metrics/dogstatsd_metrics_submission/dogstatsd.5466e01450a2cc9c0fe3382e068caaf8.png?auto=format&fit=max&w=850&dpr=2 2x"
   alt="dogstatsd" /%}

As it receives data, DogStatsD aggregates multiple data points for each unique metric into a single data point over a period of time called *the flush interval*. DogStatsD uses a flush interval of 10 seconds.

## Setup{% #setup %}

DogStatsD consists of a server, which is bundled with the Datadog Agent, and a client library, which is available in multiple languages. The DogStatsD server is enabled by default over UDP port `8125` for Agent v6+. You can set a custom port for the server if necessary. Configure your client to match the address and port of the Datadog Agent DogStatsD server.

### Datadog Agent DogStatsD server{% #datadog-agent-dogstatsd-server %}

{% tab title="Host Agent" %}
If you need to change the port, configure the `dogstatsd_port` option in the main [Agent configuration file](https://docs.datadoghq.com/agent/configuration/agent-configuration-files.md?tab=agentv6v7#agent-main-configuration-file), and restart the Agent. You can also configure DogStatsD to use a [UNIX domain socket](https://docs.datadoghq.com/extend/dogstatsd/unix_socket.md).

To enable a custom Agent DogStatsD server UDP port:

1. Set the `dogstatsd_port` parameter:

   ```yaml
   ## @param dogstatsd_port - integer - optional - default: 8125
   ## Override the Agent DogStatsD port.
   ## Note: Make sure your client is sending to the same UDP port.
   #
   dogstatsd_port: 8125
   ```

1. [Restart your Agent](https://docs.datadoghq.com/agent/configuration/agent-commands.md).

{% /tab %}

{% tab title="Container Agent" %}
By default, DogStatsD listens on UDP port **8125**, so you need to bind this port to your host port when running the Agent in a container. If your StatsD metrics come from outside of `localhost`you must set `DD_DOGSTATSD_NON_LOCAL_TRAFFIC` to `true` to allow metric collection. In order to run the Agent with the DogStatsd server up, execute the following command:

```shell
docker run -d --cgroupns host \
              --pid host \
              -v /var/run/docker.sock:/var/run/docker.sock:ro \
              -v /proc/:/host/proc/:ro \
              -v /sys/fs/cgroup/:/host/sys/fs/cgroup:ro \
              -e DD_API_KEY=<DATADOG_API_KEY> \
              -e DD_DOGSTATSD_NON_LOCAL_TRAFFIC="true" \
              -p 8125:8125/udp \
              registry.datadoghq.com/agent:latest
```

If you need to change the port used to collect StatsD metrics, use the `DD_DOGSTATSD_PORT="<NEW_DOGSTATSD_PORT>` environment variable. You can also configure DogStatsD to use a [UNIX domain socket](https://docs.datadoghq.com/extend/dogstatsd/unix_socket.md).
{% /tab %}

{% tab title="Datadog Operator" %}
StatsD metrics collection is enabled by default on [UNIX domain socket](https://docs.datadoghq.com/extend/dogstatsd/unix_socket.md). To start collecting your StatsD metrics over UDP, you need to activate the DogStatsD feature in the Operator settings.

1. Add `features.dogstatsd.hostPortConfig.enabled` to your `datadog-agent.yaml` manifest:

   ```yaml
   features:
       dogstatsd:
           hostPortConfig:
               enabled: true
   ```

This is an example `datadog-agent.yaml` manifest:

   ```yaml
   apiVersion: datadoghq.com/v2alpha1
   kind: DatadogAgent
   metadata:
     name: datadog
   spec:
     global:
       credentials:
         apiSecret:
           secretName: datadog-secret
           keyName: api-key
     features:
       dogstatsd:
         hostPortConfig:
           enabled: true
   ```

This enables the Agent to collect StatsD metrics over UDP on port `8125`.

1. Apply the change:

   ```shell
   kubectl apply -f datadog-agent.yaml
   ```

**Warning**: The `features.dogstatsd.hostPortConfig.hostPort` parameter opens a port on your host. Make sure your firewall only allows access from your applications or trusted sources. If your network plugin doesn't support `hostPorts`, so add `hostNetwork: true` in your Agent pod specifications. This shares the network namespace of your host with the Datadog Agent. It also means that all ports opened on the container are opened on the host. If a port is used both on the host and in your container, they conflict (since they share the same network namespace) and the pod does not start. Some Kubernetes installations do not allow this.

### Send StatsD metrics to the Agent{% #send-statsd-metrics-to-the-agent %}

Your application needs a reliable way to determine the IP address of its host. This is made simple in Kubernetes 1.7, which expands the set of attributes you can pass to your pods as environment variables. In versions 1.7 and above, you can pass the host IP to any pod by adding an environment variable to the PodSpec. For instance, your application manifest might look like this:

```yaml
env:
    - name: DD_AGENT_HOST
      valueFrom:
          fieldRef:
              fieldPath: status.hostIP
```

With this, any pod running your application is able to send DogStatsD metrics with port `8125` on `$DD_AGENT_HOST`.

**Note**: As a best practice, Datadog recommends using unified service tagging when assigning attributes. Unified service tagging ties Datadog telemetry together through the use of three standard tags: `env`, `service`, and `version`. To learn how to unify your environment, see [unified service tagging](https://docs.datadoghq.com/getting_started/tagging/unified_service_tagging.md).
{% /tab %}

{% tab title="Helm" %}
To gather custom metrics with [DogStatsD](https://docs.datadoghq.com/metrics/custom_metrics/dogstatsd_metrics_submission.md) with helm:

1. Update your [datadog-values.yaml](https://github.com/DataDog/helm-charts/blob/master/charts/datadog/values.yaml) file to enable DogStatsD:

   ```yaml
     dogstatsd:
       port: 8125
       useHostPort: true
       nonLocalTraffic: true
   ```

**Note**: `hostPort` functionality requires a networking provider that adheres to the [CNI specification](https://github.com/containernetworking/cni), such as Calico, Canal, or Flannel. For more information, including a workaround for non-CNI network providers, see the Kubernetes documentation: [HostPort services do not work](https://kubernetes.io/docs/setup/independent/troubleshooting-kubeadm/#hostport-services-do-not-work).

**Warning**: The `hostPort` parameter opens a port on your host. Make sure your firewall only allows access from your applications or trusted sources. If your network plugin doesn't support `hostPorts`, so add `hostNetwork: true` in your Agent pod specifications. This shares the network namespace of your host with the Datadog Agent. It also means that all ports opened on the container are opened on the host. If a port is used both on the host and in your container, they conflict (since they share the same network namespace) and the pod does not start. Some Kubernetes installations do not allow this.

1. Upgrade your Agent configuration:

   ```shell
   helm upgrade -f datadog-values.yaml <RELEASE_NAME> datadog/datadog
   ```

1. Update your application pods: Your application needs a reliable way to determine the IP address of its host. This is made simple in Kubernetes 1.7, which expands the set of attributes you can pass to your pods as environment variables. In versions 1.7 and above, you can pass the host IP to any pod by adding an environment variable to the PodSpec. For instance, your application manifest might look like this:

   ```yaml
   env:
       - name: DD_AGENT_HOST
         valueFrom:
             fieldRef:
                 fieldPath: status.hostIP
   ```

With this, any pod running your application is able to send DogStatsD metrics through port `8125` on `$DD_AGENT_HOST`.

{% /tab %}

### Origin detection{% #origin-detection %}

Datadog Agent v6.10.0 supports *origin detection*, which allows DogStatsD to detect where the container metrics come from and automatically tag metrics. When origin detection is enabled, all metrics received through UDP are tagged by the same pod tags as Autodiscovery metrics.

#### In a DogStatsD client{% #in-a-dogstatsd-client %}

Origin detection is enabled by default in all DogStatsD clients.

To **disable** origin detection in a client, perform one of the following actions:

- Set the environment variable `DD_ORIGIN_DETECTION_ENABLED=false`
- Configure the DogStatsD library to disable origin detection. For instructions, see the [documentation for your specific DogStatsD library](https://docs.datadoghq.com/extend/community/libraries.md).

#### In the Datadog Agent{% #in-the-datadog-agent %}

Origin detection is not enabled by default in the Datadog Agent. To **enable** origin detection in the Datadog Agent, set the `DD_DOGSTATSD_ORIGIN_DETECTION_CLIENT` environment variable to `true`.

Set [`shareProcessNamespace:true` in the pod spec](https://kubernetes.io/docs/tasks/configure-pod-container/share-process-namespace/) to assist the Agent for origin detection on EKS Fargate.

#### How origins are detected{% #how-origins-are-detected %}

Origin detection can be achieved in a number of ways. Origin detection through cgroups is enabled by default. Origin detection over UDP or `DD_EXTERNAL_ENV` requires configuration.

{% tab title="Cgroups" %}
On Linux, the container ID can be extracted from `procfs` entries related to `cgroups`. The client reads from `/proc/self/cgroup` or `/proc/self/mountinfo` to attempt to parse the container ID.

In cgroup v2, the container ID can be inferred by resolving the cgroup path from `/proc/self/cgroup`, combining it with the cgroup mount point from `/proc/self/mountinfo`. The resulting directory's inode is sent to the Datadog Agent. If the Datadog Agent is on the same node as the client, this information can be used to identify the pod's UID.
{% /tab %}

{% tab title="UDP" %}
To enable origin detection over UDP, add the following lines to your application manifest:

```yaml
env:
- name: DD_ENTITY_ID
    valueFrom:
      fieldRef:
        fieldPath: metadata.uid
```

The DogStatsD client attaches an internal tag, `entity_id`. The value of this tag is the content of the `DD_ENTITY_ID` environment variable, which is the pod's UID.

{% alert level="info" %}
For UDP, `pod_name` tags are not added by default to avoid creating too many [custom metrics](https://docs.datadoghq.com/metrics/custom_metrics.md).
{% /alert %}

{% /tab %}

{% tab title="DD_EXTERNAL_ENV" %}
Add the following label to your pod:

```
admission.datadoghq.com/enabled: "true"
```

If your pod has this label, the [Admissions Controller](https://docs.datadoghq.com/containers/cluster_agent/admission_controller.md) injects an environment variable, `DD_EXTERNAL_ENV`. The value of this variable is sent in a field with the metric, which can be used by the Datadog Agent to determine the metric's origin.
{% /tab %}

#### Tag cardinality{% #tag-cardinality %}

Read [Assigning Tags: Tags Cardinality](https://docs.datadoghq.com/getting_started/tagging/assigning_tags.md?tab=containerizedenvironments#tags-cardinality) for more information about tag cardinality.

##### Globally{% #globally %}

You can specify tag cardinality globally by setting the `DD_CARDINALITY` environment variable, or by passing a `'cardinality'` field to the constructor.

##### Per metric{% #per-metric %}

You can specify tag cardinality per metric by passing the value in the `cardinality` parameter. Valid values for this parameter are `"none"`, `"low"`, `"orchestrator"` or `"high"`.

### DogStatsD client{% #dogstatsd-client %}

Install the DogStatsD client library for your preferred language and configure it to match the address and port of the Datadog Agent DogStatsD server.

#### Install the DogStatsD client{% #install-the-dogstatsd-client %}

Official Datadog-DogStatsD client libraries are available for the following languages. Any compliant StatsD client works with DogStatsD and the Agent, but does not include the Datadog-specific features mentioned above:

{% tab title="Python" %}

```shell
pip install datadog
```

{% /tab %}

{% tab title="Ruby" %}

```shell
gem install dogstatsd-ruby
```

{% /tab %}

{% tab title="Go" %}

```shell
go get github.com/DataDog/datadog-go/v5/statsd
```

{% /tab %}

{% tab title="Java" %}
The Java DataDog StatsD Client is distributed with maven central, and can be [downloaded from Maven](https://search.maven.org/search?q=g:com.datadoghq%20a:java-dogstatsd-client). Start by adding the following configuration to your `pom.xml`:

```xml
<dependency>
    <groupId>com.datadoghq</groupId>
    <artifactId>java-dogstatsd-client</artifactId>
    <version>4.2.1</version>
</dependency>
```

{% /tab %}

{% tab title="PHP" %}
Add the following to your `composer.json`:

```text
"datadog/php-datadogstatsd": "1.6.*"
```

**Note**: The first version shipped in Composer is *0.0.3*

Or manually clone the repository at [github.com/DataDog/php-datadogstatsd](https://github.com/DataDog/php-datadogstatsd#php-datadog-statsd-client) and set it up with `require './src/DogStatsd.php'`.
{% /tab %}

{% tab title=".NET" %}
Install the package directly using the Nuget CLI or get [the PackageReference from NuGet](https://www.nuget.org/packages/DogStatsD-CSharp-Client):

```shell
dotnet add package DogStatsD-CSharp-Client
```

{% /tab %}



#### Instantiate the DogStatsD client{% #instantiate-the-dogstatsd-client %}

Once your DogStatsD client is installed, instantiate it in your code:

{% tab title="Python" %}

```python
from datadog import initialize, statsd

options = {
    'statsd_host':'127.0.0.1',
    'statsd_port':8125
}

initialize(**options)
```

{% alert level="danger" %}
By default, Python DogStatsD client instances (including the `statsd` global instance) cannot be shared across processes but are thread-safe. Because of this, the parent process and each child process must create their own instances of the client or the buffering must be explicitly disabled by setting `disable_buffering` to `True`. See the documentation on [datadog.dogstatsd](https://datadogpy.readthedocs.io/en/latest/#datadog-dogstatsd) for more details.
{% /alert %}

{% /tab %}

{% tab title="Ruby" %}

```ruby
# Import the library
require 'datadog/statsd'

# Create a DogStatsD client instance.
statsd = Datadog::Statsd.new('localhost', 8125)
```

{% alert level="info" %}
If you use DogStatsD with the Container Agent or in Kubernetes, you must instantiate the host to which StatsD metrics are forwarded to with the `$DD_DOGSTATSD_SOCKET` environment variable if using a UNIX Domain Socket, or with the `$DD_AGENT_HOST` environment variable if you are using the host port binding method.
{% /alert %}

{% /tab %}

{% tab title="Go" %}

```go
dogstatsd_client, err := statsd.New("127.0.0.1:8125")
if err != nil {
    log.Fatal(err)
}
```

For more options, see [Datadog's GoDoc](https://pkg.go.dev/github.com/DataDog/datadog-go/v5/statsd).
{% /tab %}

{% tab title="Java" %}

```java
import com.timgroup.statsd.NonBlockingStatsDClientBuilder;
import com.timgroup.statsd.StatsDClient;

public class DogStatsdClient {

    public static void main(String[] args) throws Exception {

        StatsDClient statsd = new NonBlockingStatsDClientBuilder()
            .prefix("statsd")
            .hostname("localhost")
            .port(8125)
            .build();


        // alternatively
        StatsDClient statsdAlt = new NonBlockingStatsDClient(
            new NonBlockingStatsDClientBuilder(
                .prefix("statsd")
                .hostname("localhost")
                .port(8125)
                .resolve()));

    }
}
```

{% /tab %}

{% tab title="PHP" %}
Instantiate a new DogStatsd object using composer:

```php
<?php

require __DIR__ . '/vendor/autoload.php';

use DataDog\DogStatsd;

$statsd = new DogStatsd(
    array('host' => '127.0.0.1',
          'port' => 8125,
     )
  );
```

{% /tab %}

{% tab title=".NET" %}
Configure the DogStatsd class:

```csharp
// The code is located under the StatsdClient namespace
using StatsdClient;

// ...

var dogstatsdConfig = new StatsdConfig
{
    StatsdServerName = "127.0.0.1",
    StatsdPort = 8125,
};

using (var dogStatsdService = new DogStatsdService())
{
    if (!dogStatsdService.Configure(dogstatsdConfig))
        throw new InvalidOperationException("Cannot initialize DogstatsD. Set optionalExceptionHandler argument in the `Configure` method for more information.");
    // ...
} // Flush metrics not yet sent
```

{% /tab %}



### Client instantiation parameters{% #client-instantiation-parameters %}

**Note**: As a best practice, Datadog recommends using unified service tagging when assigning tags. Unified service tagging ties Datadog telemetry together through the use of three standard tags: `env`, `service`, and `version`. To learn how to unify your environment, see [unified service tagging](https://docs.datadoghq.com/getting_started/tagging/unified_service_tagging.md).

In addition to the required DogStatsD configuration (`url` and `port`), the following optional parameters are available for your DogStatsD client:

{% tab title="Python" %}

| Parameter              | Type            | Default     | Description                                                                                                    |
| ---------------------- | --------------- | ----------- | -------------------------------------------------------------------------------------------------------------- |
| `statsd_host`          | String          | `localhost` | The host of your DogStatsD server.                                                                             |
| `statsd_port`          | Integer         | `8125`      | The port of your DogStatsD server.                                                                             |
| `statsd_socket_path`   | String          | `null`      | The path to the DogStatsD UNIX domain socket (overrides `host` and `port`, only supported with the Agent v6+). |
| `statsd_constant_tags` | List of strings | `null`      | Tags to apply to all metrics, events, and service checks.                                                      |
| `statsd_namespace`     | String          | `null`      | Namespace to prefix all metrics, events, and service checks.                                                   |

For the full list of optional parameters available for `datadog.initialize()` as well as parameters only available when explicitly instantiating `datadog.dogstatsd.DogStatsd` instances, see the [Datadog Python library](https://datadogpy.readthedocs.io/en/latest).
{% /tab %}

{% tab title="Ruby" %}

| Parameter       | Type            | Default     | Description                                                                                                    |
| --------------- | --------------- | ----------- | -------------------------------------------------------------------------------------------------------------- |
| `host`          | String          | `localhost` | The host of your DogStatsD server.                                                                             |
| `port`          | Integer         | `8125`      | The port of your DogStatsD server.                                                                             |
| `socket_path`   | String          | `null`      | The path to the DogStatsD UNIX domain socket (overrides `host` and `port`, only supported with the Agent v6+). |
| `tags`          | List of strings | `null`      | Tags to apply to all metrics, events, and service checks.                                                      |
| `namespace`     | String          | `null`      | Namespace to prefix to all metrics, events, and service checks.                                                |
| `single_thread` | Boolean         | `false`     | Makes the client send the metrics on the main thread when enabled rather than in a companion thread.           |

For the full list of optional parameters, see the [dogstatsd-ruby repo](https://github.com/DataDog/dogstatsd-ruby) on GitHub.
{% /tab %}

{% tab title="Go" %}
The Go client has multiple options for configuring the behavior of your client.

| Parameter         | Type            | Description                                                                 |
| ----------------- | --------------- | --------------------------------------------------------------------------- |
| `WithNamespace()` | String          | Configure a namespace to prefix to all metrics, events, and service checks. |
| `WithTags()`      | List of strings | Global tags applied to every metric, event, and service check.              |

For all available options, see [Datadog's GoDoc](https://pkg.go.dev/github.com/DataDog/datadog-go/v5/statsd#Option).
{% /tab %}

{% tab title="Java" %}
As of v2.10.0 the recommended way to instantiate the client is with the NonBlockingStatsDClientBuilder. You can use the following builder methods to define the client parameters.

| Builder Method                               | Type           | Default   | Description                                                                        |
| -------------------------------------------- | -------------- | --------- | ---------------------------------------------------------------------------------- |
| `prefix(String val)`                         | String         | null      | The prefix to apply to all metrics, events, and service checks.                    |
| `hostname(String val)`                       | String         | localhost | The host name of the targeted StatsD server.                                       |
| `port(int val)`                              | Integer        | 8125      | The port of the targeted StatsD server.                                            |
| `constantTags(String... val)`                | String varargs | null      | Global tags to be applied to every metric, event, and service check.               |
| `blocking(boolean val)`                      | Boolean        | false     | The type of client to instantiate: blocking vs non-blocking.                       |
| `socketBufferSize(int val)`                  | Integer        | -1        | The size of the underlying socket buffer.                                          |
| `enableTelemetry(boolean val)`               | Boolean        | false     | Client telemetry reporting.                                                        |
| `entityID(String val)`                       | String         | null      | Entity ID for origin detection.                                                    |
| `errorHandler(StatsDClientErrorHandler val)` | Integer        | null      | Error handler in case of an internal client error.                                 |
| `maxPacketSizeBytes(int val)`                | Integer        | 8192/1432 | The maximum packet size; 8192 over UDS, 1432 for UDP.                              |
| `processorWorkers(int val)`                  | Integer        | 1         | The number of processor worker threads assembling buffers for submission.          |
| `senderWorkers(int val)`                     | Integer        | 1         | The number of sender worker threads submitting buffers to the socket.              |
| `poolSize(int val)`                          | Integer        | 512       | Network packet buffer pool size.                                                   |
| `queueSize(int val)`                         | Integer        | 4096      | Maximum number of unprocessed messages in the queue.                               |
| `timeout(int val)`                           | Integer        | 100       | the timeout in milliseconds for blocking operations. Applies to unix sockets only. |

For more information, search the Java DogStatsD [package](https://javadoc.io/doc/com.datadoghq/java-dogstatsd-client/latest/index.html) for the NonBlockingStatsDClient Class and NonBlockingStatsDClientBuilder Class. Make sure you view the version that matches your client release.
{% /tab %}

{% tab title="PHP" %}

| Parameter          | Type            | Default     | Description                                                                                                                                                                                            |
| ------------------ | --------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `host`             | String          | `localhost` | The host of your DogStatsD server. If this is not set the Agent looks at the `DD_AGENT_HOST` or `DD_DOGSTATSD_URL` environment variable.                                                               |
| `port`             | Integer         | `8125`      | The port of your DogStatsD server. If this is not set, the Agent looks at the `DD_DOGSTATSD_PORT` or `DD_DOGSTATSD_URL` environment variable.                                                          |
| `socket_path`      | String          | `null`      | The path to the DogStatsD UNIX domain socket (overrides `host` and `port`). This is only supported with Agent v6+. If this is not set, the Agent looks at the `DD_DOGSTATSD_URL` environment variable. |
| `global_tags`      | List of Strings | `null`      | Tags to apply to all metrics, events, and service checks. The `@dd.internal.entity_id` tag is appended to global_tags from the `DD_ENTITY_ID` environment variable.                                    |
| `origin_detection` | Boolean         | True        | Should origin detection fields be added to each metric?                                                                                                                                                |
| `container_id`     | String          | `null`      | A container id to tag all metrics with for origin detection.                                                                                                                                           |

{% /tab %}

{% tab title=".NET" %}

| Parameter          | Type            | Default     | Description                                                          |
| ------------------ | --------------- | ----------- | -------------------------------------------------------------------- |
| `StatsdServerName` | String          | `localhost` | The host name of the targeted StatsD server.                         |
| `StatsdPort`       | Integer         | `8125`      | The port of the targeted StatsD server.                              |
| `Prefix`           | String          | `null`      | Prefix to apply to every metric, event, and service check.           |
| `ConstantTags`     | List of strings | `null`      | Global tags to be applied to every metric, event, and service check. |
| `OriginDetection`  | Bool            | True        | Should origin detection fields be added to each metric?              |
| `ContainerID`      | String          | `null`      | A container id to tag all metrics with for origin detection.         |

{% /tab %}

## Dive into DogStatsD{% #dive-into-dogstatsd %}

DogStatsD and StatsD are broadly similar, however, DogStatsD contains advanced features which are specific to Datadog, including available data types, events, service checks, and tags:

- [Send metrics to Datadog with DogStatsD.](https://docs.datadoghq.com/metrics/custom_metrics/dogstatsd_metrics_submission.md)
- [Send events to Datadog with DogStatsD.](https://docs.datadoghq.com/events/guides/dogstatsd.md)
- [Send service checks to Datadog with DogStatsD.](https://docs.datadoghq.com/extend/service_checks/dogstatsd_service_checks_submission.md)

If you're interested in learning more about the datagram format used by DogStatsD, or want to develop your own Datadog library, see the [datagram and shell usage](https://docs.datadoghq.com/extend/dogstatsd/datagram_shell.md) section, which also explains how to send metrics and events straight from the command line.

## Further reading{% #further-reading %}

- [Enable DogStatsD for Node.js through the Node.js integration](https://docs.datadoghq.com/integrations/node.md)
- [Introduction to DogStatsD](https://docs.datadoghq.com/extend/dogstatsd.md)
- [Official and Community created API and DogStatsD client libraries](https://docs.datadoghq.com/extend/libraries.md)
- [Monitor your Linux web apps on Azure App Service with Datadog](https://www.datadoghq.com/blog/monitor-azure-app-service-linux/)
- [Bring high-performance observability to secure Kubernetes environments with Datadog's CSI driver](https://www.datadoghq.com/blog/datadog-csi-driver/)
