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

# Memcached

> OpenTelemetry receiver for Memcached

# Memcached Receiver

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

**Available in:** `contrib`

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

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

## Supported Telemetry

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

## Overview

## Configuration

The following settings are required:

* `endpoint` (default: `localhost:11211`): The hostname/IP address and port or, unix socket file path of the memcached instance
* `transport` (default: no default): Known protocols are "tcp", "tcp4" (IPv4-only), "tcp6"
  (IPv6-only), "udp", "udp4" (IPv4-only), "udp6" (IPv6-only), "ip", "ip4"
  (IPv4-only), "ip6" (IPv6-only), "unix", "unixgram" and "unixpacket".

The following settings are optional:

* `collection_interval` (default = `10s`): This receiver runs on an interval.
  Each time it runs, it queries memcached, creates metrics, and sends them to the
  next consumer. The `collection_interval` configuration option tells this
  receiver the duration between runs. This value must be a string readable by
  Golang's `ParseDuration` function (example: `1h30m`). Valid time units are
  `ns`, `us` (or `µs`), `ms`, `s`, `m`, `h`.
* `initial_delay` (default = `1s`): defines how long this receiver waits before starting.
* `tls`: configures the TLS settings used to connect to memcached. TLS is
  disabled by default (`insecure: true`), preserving plaintext connections. See
  [TLS Configuration Settings](https://github.com/open-telemetry/opentelemetry-collector/blob/main/config/configtls/README.md)
  for the full set of supported options.

Example:

```yaml theme={null}
receivers:
  memcached:
    endpoint: "localhost:11211"
    collection_interval: 10s
    transport: tcp
```

Example with TLS enabled:

```yaml theme={null}
receivers:
  memcached:
    endpoint: "localhost:11211"
    tls:
      insecure: false
      ca_file: /etc/ssl/certs/ca.crt
```

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/memcachedreceiver/config.go)
with detailed sample configurations in [testdata/config.yaml](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/memcachedreceiver/testdata/config.yaml).

## Metrics

Details about the metrics produced by this receiver can be found in [metadata.yaml](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/memcachedreceiver/metadata.yaml) with further documentation in [documentation.md](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/memcachedreceiver/documentation.md)

## Metrics

| Metric Name | Description | Unit | Type | Attributes |
| - | - | - | - | - |
| ✅ `memcached.bytes` | Current number of bytes used by this server to store items. | By | Gauge | |
| ✅ `memcached.commands` | Commands executed. | \{commands} | Counter | command |
| ✅ `memcached.connections.current` | The current number of open connections. | \{connections} | UpDownCounter | |
| ✅ `memcached.connections.total` | Total number of connections opened since the server started running. | \{connections} | Counter | |
| ✅ `memcached.cpu.usage` | Accumulated user and system time. | s | Counter | state |
| ✅ `memcached.current_items` | Number of items currently stored in the cache. | \{items} | UpDownCounter | |
| ✅ `memcached.evictions` | Cache item evictions. | \{evictions} | Counter | |
| ✅ `memcached.network` | Bytes transferred over the network. | By | Counter | direction |
| ✅ `memcached.operation_hit_ratio` | Hit ratio for operations, expressed as a percentage value between 0.0 and 100.0. | % | Gauge | operation |
| ✅ `memcached.operations` | Operation counts. | \{operations} | Counter | type, operation |
| ✅ `memcached.threads` | Number of threads used by the memcached instance. | \{threads} | UpDownCounter | |

## Attributes

| Attribute Name | Description | Type | Values |
| - | - | - | - |
| `command` | The type of command. | string | `get`, `set`, `flush`, `touch` |
| `direction` | Direction of data flow. | string | `sent`, `received` |
| `operation` | The type of operation. | string | `increment`, `decrement`, `get` |
| `state` | The type of CPU usage. | string | `system`, `user` |
| `type` | Result of cache request. | string | `hit`, `miss` |

## Configuration

### Example Configuration

```yaml theme={null}
memcached:
  endpoint: "localhost:11211"
  collection_interval: 10s
memcached/tls:
  endpoint: "localhost:11211"
  collection_interval: 10s
  tls:
    insecure: false
    ca_file: /etc/ssl/certs/ca.crt
```

***

*Last generated: 2026-10-05*
