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

# Expvar

> OpenTelemetry receiver for Expvar

# Expvar Receiver

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

**Available in:** `contrib`

**Maintainers:** [@jamesmoessis](https://github.com/jamesmoessis), [@MovieStoreGuy](https://github.com/MovieStoreGuy)

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

## Supported Telemetry

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

## Overview

## Configuration

### Default

By default, without any configuration, a request will be sent to `http://localhost:8000/debug/vars`
every 60 seconds. The default configuration is achieved by the following:

```yaml theme={null}
receivers:
  expvar:
```

### Customising

The following can be configured:

* Configure the HTTP client for scraping the expvar variables. The full set of
  configuration options for the client can be found in the core repo's
  [confighttp](https://github.com/open-telemetry/opentelemetry-collector/tree/main/config/confighttp#client-configuration).
  * defaults:
    * `endpoint = http://localhost:8000/debug/vars`
    * `timeout = 3s`
* `collection_interval` - Configure how often the metrics are scraped.
  * default: 1m
* `initial_delay` (default = `1s`): defines how long this receiver waits before starting.
* `metrics` - Enable or disable metrics by name.

### Example configuration

```yaml theme={null}
receivers:
  expvar:
    endpoint: "http://localhost:8000/custom/path"
    timeout: 1s
    collection_interval: 30s
    metrics:
      process.runtime.memstats.total_alloc:
        enabled: true
      process.runtime.memstats.mallocs:
        enabled: false
```

## Metrics

| Metric Name                                  | Description                                                                                 | Unit       | Type          | Attributes |
| -------------------------------------------- | ------------------------------------------------------------------------------------------- | ---------- | ------------- | ---------- |
| ✅ `process.runtime.memstats.buck_hash_sys`   | Bytes of memory in profiling bucket hash tables.                                            | By         | UpDownCounter |            |
| ✅ `process.runtime.memstats.frees`           | Cumulative count of heap objects freed.                                                     | \{objects} | Counter       |            |
| ✅ `process.runtime.memstats.gc_cpu_fraction` | The fraction of this program's available CPU time used by the GC since the program started. | 1          | Gauge         |            |
| ✅ `process.runtime.memstats.gc_sys`          | Bytes of memory in garbage collection metadata.                                             | By         | UpDownCounter |            |
| ✅ `process.runtime.memstats.heap_alloc`      | Bytes of allocated heap objects.                                                            | By         | UpDownCounter |            |
| ✅ `process.runtime.memstats.heap_idle`       | Bytes in idle (unused) spans.                                                               | By         | UpDownCounter |            |
| ✅ `process.runtime.memstats.heap_inuse`      | Bytes in in-use spans.                                                                      | By         | UpDownCounter |            |
| ✅ `process.runtime.memstats.heap_objects`    | Number of allocated heap objects.                                                           | \{objects} | UpDownCounter |            |
| ✅ `process.runtime.memstats.heap_released`   | Bytes of physical memory returned to the OS.                                                | By         | UpDownCounter |            |
| ✅ `process.runtime.memstats.heap_sys`        | Bytes of heap memory obtained by the OS.                                                    | By         | UpDownCounter |            |
| ✅ `process.runtime.memstats.last_pause`      | The most recent stop-the-world pause time.                                                  | ns         | Gauge         |            |
| ❌ `process.runtime.memstats.lookups`         | Number of pointer lookups performed by the runtime.                                         | \{lookups} | UpDownCounter |            |
| ✅ `process.runtime.memstats.mallocs`         | Cumulative count of heap objects allocated.                                                 | \{objects} | Counter       |            |
| ✅ `process.runtime.memstats.mcache_inuse`    | Bytes of allocated mcache structures.                                                       | By         | UpDownCounter |            |
| ✅ `process.runtime.memstats.mcache_sys`      | Bytes of memory obtained from the OS for mcache structures.                                 | By         | UpDownCounter |            |
| ✅ `process.runtime.memstats.mspan_inuse`     | Bytes of allocated mspan structures.                                                        | By         | UpDownCounter |            |
| ✅ `process.runtime.memstats.mspan_sys`       | Bytes of memory obtained from the OS for mspan structures.                                  | By         | UpDownCounter |            |
| ✅ `process.runtime.memstats.next_gc`         | The target heap size of the next GC cycle.                                                  | By         | UpDownCounter |            |
| ✅ `process.runtime.memstats.num_forced_gc`   | Number of GC cycles that were forced by the application calling the GC function.            | By         | Counter       |            |
| ✅ `process.runtime.memstats.num_gc`          | Number of completed GC cycles.                                                              | By         | Counter       |            |
| ✅ `process.runtime.memstats.other_sys`       | Bytes of memory in miscellaneous off-heap runtime allocations.                              | By         | UpDownCounter |            |
| ✅ `process.runtime.memstats.pause_total`     | The cumulative nanoseconds in GC stop-the-world pauses since the program started.           | By         | Counter       |            |
| ✅ `process.runtime.memstats.stack_inuse`     | Bytes in stack spans.                                                                       | By         | UpDownCounter |            |
| ✅ `process.runtime.memstats.stack_sys`       | Bytes of stack memory obtained from the OS.                                                 | By         | UpDownCounter |            |
| ✅ `process.runtime.memstats.sys`             | Total bytes of memory obtained from the OS.                                                 | By         | UpDownCounter |            |
| ❌ `process.runtime.memstats.total_alloc`     | Cumulative bytes allocated for heap objects.                                                | By         | Counter       |            |

## Configuration

### Example Configuration

```yaml theme={null}
# The default, minimal configuration
expvar/default:

# More custom configuration
expvar/custom:
  endpoint: "http://localhost:8000/custom/path"
  timeout: 5s
  collection_interval: 30s
  metrics:
    process.runtime.memstats.total_alloc:
      enabled: true
    process.runtime.memstats.mallocs:
      enabled: false

expvar/bad_hostless_endpoint:
  endpoint: "https:///this/aint/a/good/endpoint"

expvar/bad_invalid_url:
  endpoint: "#$%^&*()_"

expvar/bad_schemeless_endpoint:
  endpoint: "localhost:8000/custom/path"
```

***

*Last generated: 2026-07-06*
