> ## Documentation Index
> Fetch the complete documentation index at: https://otel.fyi/llms.txt
> Use this file to discover all available pages before exploring further.

# Carbon

> OpenTelemetry receiver for Carbon

# Carbon Receiver

![Status](https://img.shields.io/badge/status-beta-yellow)

**Available in:** `contrib`

**Maintainers:** [@atoulme](https://github.com/atoulme)

**Source:** [opentelemetry-collector-contrib](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/carbonreceiver)

## Supported Telemetry

![Metrics](https://img.shields.io/badge/metrics-beta-green)

## Overview

> :information\_source: The `wavefront` receiver is based on Carbon and binds to the
> same port by default. This means the `carbon` and `wavefront` receivers
> cannot both be enabled with their respective default configurations. To
> support running both receivers in parallel, change the `endpoint` port on one
> of the receivers.

## Configuration

The following settings are required:

* `endpoint` (default = `0.0.0.0:2003`): Address and port that the
  receiver should bind to.
* `transport` (default = `tcp`): Must be either `tcp` or `udp`.

The following setting are optional:

* `tcp_idle_timeout` (default = `30s`): The maximum duration that a tcp
  connection will idle wait for new data. This value is ignored if the
  transport is not `tcp`.

In addition, a `parser` section can be defined with the following settings:

* `type` (default `plaintext`): Specifies the type of parser to be used
  and must be either `plaintext` or `regex`.
* `config`: Specifies any special configuration of the selected parser.

Example:

```yaml theme={null}
receivers:
  carbon/receiver_settings:
    endpoint: localhost:8080
    transport: udp
  carbon/regex:
    parser:
      type: regex
      config:
        rules:
          - regexp: "(?P<key_base>test)\\.env(?P<key_env>[^.]*)\\.(?P<key_host>[^.]*)"
            name_prefix: "name-prefix"
            labels:
              dot.key: dot.value
              key: value
            type: cumulative
          - regexp: "(?P<key_just>test)\\.(?P<key_match>.*)"
        name_separator: "_"
```

The full list of settings exposed for this receiver are documented in [config.go](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/carbonreceiver/config.go)
with detailed sample configurations in [testdata/config.yaml](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/carbonreceiver/testdata/config.yaml).

## Configuration

### Example Configuration

```yaml theme={null}
carbon:
carbon/receiver_settings:
  # endpoint specifies the network interface and port which will receive
  # Carbon data.
  endpoint: localhost:8080
  # transport specifies either "tcp" (the default) or "udp".
  transport: udp
  # tcp_idle_timeout is max duration that a tcp connection will idle wait for
  # new data. This value is ignored is the transport is not "tcp". The default
  # value is 30 seconds.
  tcp_idle_timeout: 5s
  # parser section is used to configure the actual parser to handle the
  # received data. The default is "plaintext", see
  # https://graphite.readthedocs.io/en/latest/feeding-carbon.html#the-plaintext-protocol.
  parser:
    # type specifies the type of parser to be used, the default is "plaintext"
    type: plaintext
    # config specifies any special configuration of the selected parser. What
    # goes under the section depends on the type of parser selected.
    config:
carbon/regex:
  parser:
    # The "regex" parser can breakdown the "metric path" of a Carbon metric
    # into metric labels. This is typically used to extract the labels from
    # a naming hierarchy, see https://graphite.readthedocs.io/en/latest/feeding-carbon.html#step-1-plan-a-naming-hierarchy
    type: regex
    # config section with the custom config for the "regex" parser.
    config:
      # Rules with regular expressions to be applied to the received metrics.
      # The first rule that matches the metric is applied and no further rules
      # are applied. If no rules match the metric is processed by the "plaintext"
      # parser.
      rules:
        # The first rule generates extract dimensions with keys: "base", "env",
        # and "host" if the "metric path" matches the regular expression of the
        # rule. Regular expression named captures prefixed with "key_" are used
        # to populate metric labels, while named captures prefixed with "name_"
        # are used to generate the final metric name. The "name_*" captures are
        # sorted by name and their values are used to compose the resulting
        # metric name.
        - regexp: "(?P<key_base>test)\\.env(?P<key_env>[^.]*)\\.(?P<key_host>[^.]*)"
          # name_prefix is added when to the resulting metric name.
          name_prefix: "name-prefix"
          # labels to be added to the metrics matching this rule.
          labels:
            dot.key: dot.value
            key: value
          # type is used to select the metric type to be set, the default is
          # "gauge", the other alternative is "cumulative".
          type: cumulative
        # The second rule matches metric with or without a prefix.
        - regexp: "(optional_prefix\\.)?(?P<key_just>test)\\.(?P<key_match>.*)"
        # The third rule parses an optional dimension with key "experiment".
        - regexp: "(experiment(?P<key_experiment>[0-9]+)\\.)?(?P<key_just>test)\\.(?P<key_match>.*)"
        # The forth rule for this "regex" parser.
        - regexp: "(?P<key_just>test)\\.(?P<key_match>.*)"
      # Name separator is used when concatenating named regular expression
      # captures prefixed with "name_"
      name_separator: "_"
```

***

*Last generated: 2026-07-06*
