# Go Performance Profiler

### Go Performance Profiler Extension

The Go Performance Profiler Extension can be used to enable the Go Performance Profiler, also known as pprof, for a collector. It configures an HTTP server that exposes runtime profiling data in the format expected by the [pprof visualization tool](https://github.com/google/pprof).

### Configuration Table

<table><thead><tr><th width="212.203125">Parameter</th><th width="117.33203125">Type</th><th>Default</th><th>Description</th></tr></thead><tbody><tr><td>listen_address</td><td><code>string</code></td><td>127.0.0.1</td><td>The IP address or hostname to bind the profiler to. Setting to <code>0.0.0.0</code> will listen to all network interfaces.</td></tr><tr><td>tcp_port</td><td><code>int</code></td><td>1777</td><td>The TCP port to bind the profiler to.</td></tr><tr><td>block_profile_fraction</td><td><code>fraction</code></td><td>0</td><td>The fraction of blocking events that are profiled, must be a number between 0 and 1. A value of zero will profile no blocking events.</td></tr><tr><td>mutex_profile_fraction</td><td><code>fraction</code></td><td>0</td><td>The fraction of mutex contention events that are profiled, must be a number between 0 and 1. A value of zero will profile no mutex contention events</td></tr><tr><td>should_write_file</td><td><code>bool</code></td><td>false</td><td>If true, the collector will write the CPU profile to a file on shutdown.</td></tr><tr><td>cpu_profile_file_name</td><td><code>string</code></td><td>$OIQ_OTEL_COLLECTOR_HOME/observiq-otel-collector.pprof</td><td>The file name to write the CPU Profile. The default is <code>observiq-otel-collector.pprof</code> written in the collector's home directory.</td></tr></tbody></table>

{% hint style="info" %}
**NOTE**

The CPU profile file is only written once the collector has been stopped and the `should_write_file` parameter is set to true.
{% endhint %}

### Example Configuration

**Web Interface**

<figure><img src="/files/EmlHtPtCqUBKr0EMKvBN" alt="Bindplane docs - Go Performance Profiler - image 1"><figcaption></figcaption></figure>

**Standalone Extension**

```yaml
apiVersion: bindplane.observiq.com/v1
kind: Extension
metadata:
  name: go-pprof
spec:
  type: pprof
  parameters:
    - name: listen_address
      value: 127.0.0.1
    - name: tcp_port
      value: 1777
    - name: block_profile_fraction
      value: 0
    - name: mutex_profile_fraction
      value: 0
    - name: should_write_file
      value: true
    - name: cpu_profile_file_name
      value: $OIQ_OTEL_COLLECTOR_HOME/observiq-otel-collector.pprof
```

**Configuration with Embedded Extension**

// cspell:ignore 01HKTMAPMRJEA1EYA4KC10NX5V

```yaml
apiVersion: bindplane.observiq.com/v1
kind: Configuration
metadata:
  id: linux-metrics
  name: linux-metrics
  labels:
    platform: linux
spec:
  extensions:
    - id: 01HKTMAPMRJEA1EYA4KC10NX5V
      type: pprof
      parameters:
        - name: listen_address
          value: 127.0.0.1
        - name: tcp_port
          value: 1777
        - name: block_profile_fraction
          value: 0
        - name: mutex_profile_fraction
          value: 0
        - name: should_write_file
          value: false
        - name: cpu_profile_file_name
          value: $OIQ_OTEL_COLLECTOR_HOME/observiq-otel-collector.pprof
  selector:
    matchLabels:
      configuration: linux-metrics
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.bindplane.com/configuration/bindplane-otel-collector/extensions/go-performance-profiler.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
