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

# Pprof

> OpenTelemetry receiver for Pprof

# Pprof Receiver

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

**Available in:** `contrib`

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

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

## Overview

## Configuration

The receiver supports four independent ingestion modes that can be combined in a
single receiver instance. At least one section must be configured.

* `remote`: poll pprof from a remote HTTP endpoint
* `file`: read pprof files matching a glob pattern
* `self`: profile the running collector
* `server`: accept pushed pprof data over HTTP at `POST /v1/pprof`

Each scraping section (`remote`, `file`, `self`) accepts its own `collection_interval`
(default `10s`) and `initial_delay` (default `1s`).

### `remote`

Accepts every field of [`confighttp.ClientConfig`](https://github.com/open-telemetry/opentelemetry-collector/blob/main/config/confighttp/README.md).

* `endpoint` (required): the URL to fetch pprof data from.

### `file`

* `include` (required): glob pattern for pprof files to read.

### `self`

* `block_profile_fraction` (default `1`): fraction of blocking events profiled.
  See [https://golang.org/pkg/runtime/#SetBlockProfileRate](https://golang.org/pkg/runtime/#SetBlockProfileRate).
* `mutex_profile_fraction` (default `1`): fraction of mutex contention events profiled.
  See [https://golang.org/pkg/runtime/#SetMutexProfileFraction](https://golang.org/pkg/runtime/#SetMutexProfileFraction).

### `server`

Accepts every field of [`confighttp.ServerConfig`](https://github.com/open-telemetry/opentelemetry-collector/blob/main/config/confighttp/README.md).
The server exposes a single endpoint:

```
POST /v1/pprof
Content-Type: application/octet-stream
```

The body is a serialized pprof `profile.proto`. Standard `Content-Encoding` values
(e.g. `gzip`) are handled transparently by `confighttp`.

#### Pushing an existing pprof file

A `profile.proto` is already gzip-encoded on disk by the standard `runtime/pprof`
package, so the file bytes can be sent as-is with `Content-Encoding: gzip`:

```go theme={null}
package main

import (
	"log"
	"net/http"
	"os"
)

func main() {
	f, err := os.Open("cpu.pprof")
	if err != nil {
		log.Fatal(err)
	}
	defer f.Close()

	req, err := http.NewRequest(http.MethodPost, "http://localhost:4040/v1/pprof", f)
	if err != nil {
		log.Fatal(err)
	}
	req.Header.Set("Content-Type", "application/octet-stream")
	req.Header.Set("Content-Encoding", "gzip")

	resp, err := http.DefaultClient.Do(req)
	if err != nil {
		log.Fatal(err)
	}
	defer resp.Body.Close()

	if resp.StatusCode != http.StatusNoContent {
		log.Fatalf("unexpected status: %s", resp.Status)
	}
}
```

### Example

```yaml theme={null}
receivers:
  pprof:
    remote:
      endpoint: http://my-svc:9090/debug/pprof/profile?seconds=1
      collection_interval: 30s
      initial_delay: 10s
    server:
      endpoint: 0.0.0.0:4040
      tls:
        cert_file: server.crt
        key_file: server.key
    file:
      include: /tmp/pprof/*
      collection_interval: 10s
      initial_delay: 20s
    self:
      collection_interval: 15s
      initial_delay: 1s
```

***

*Last generated: 2026-07-06*
