# Connect OpenTelemetry Collectors Using the OpAMP Supervisor

This guide walks through building a **custom OpenTelemetry Collector** with the [OpenTelemetry Collector Builder (OCB)](https://github.com/open-telemetry/opentelemetry-collector/tree/main/cmd/builder) that includes Bindplane components and running it under the [**OpAMP Supervisor**](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/cmd/opampsupervisor) so it can be remotely managed by Bindplane.

This approach is ideal when you want to:

* Customize which receivers, processors, and exporters are compiled into your collector
* Retain centralized configuration and lifecycle management through Bindplane
* Experiment locally or deploy to VMs and bare-metal hosts

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

This guide is intended as a starting point. For a more production-ready workflow outline that uses the [OpenTelemetry Distribution Builder](https://github.com/observIQ/otel-distro-builder) and Bindplane Agent Types, please refer to the detailed guides here:

* [Using an OpenTelemetry Distribution with Bindplane](/how-to-guides/collector-management/bring-your-own-collector/using-an-opentelemetry-distribution-with-bindplane.md)
* [Custom OpenTelemetry Collectors: Build, Run, and Manage at Scale](https://bindplane.com/blog/custom-opentelemetry-collectors-build-run-and-manage-at-scale)
* [BYOC - Feature Guide](/feature-guides/deployment-and-management/bring-your-own-collector.md)
  {% endhint %}

### Prerequisites and Version Alignment

Before building anything, ensure all components use the **same base OpenTelemetry Collector version**.

#### Choose a base version

1. Identify the OpenTelemetry Collector version used by the Bindplane Distribution of OpenTelemetry (BDOT).
2. Use this version consistently across:
   * OpenTelemetry Collector Contrib
   * OpenTelemetry Collector Builder (OCB)
   * OpAMP Supervisor
   * All components referenced in your manifest

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

Some OpenTelemetry artifacts (such as OCB or the OpAMP Supervisor) may not be released for every collector version if no changes occurred. Always refer to the official[ OpenTelemetry Collector Releases](https://github.com/open-telemetry/opentelemetry-collector-releases/releases) for the correct versions.
{% endhint %}

### Download the OpenTelemetry Collector Builder (OCB)

The OpenTelemetry Collector Builder generates a custom collector binary from a manifest file.

#### Requirements

* [Go installed](https://go.dev/doc/install) on your system.

#### Download

* Download the OCB release that matches your chosen collector version from from the [OpenTelemetry Collector Releases](https://github.com/open-telemetry/opentelemetry-collector-releases/releases).

{% hint style="info" %}
NOTE

For more guidance view the [OCB documentation](https://opentelemetry.io/docs/collector/extend/ocb/).
{% endhint %}

### Create the Collector Manifest

Start with the standard OpenTelemetry Collector Contrib manifest and save it as `manifest.yaml`.

* Base Manifest: Use the [base `otelcol-contrib` manifest](https://github.com/open-telemetry/opentelemetry-collector-releases/blob/main/distributions/otelcol-contrib/manifest.yaml).

This file defines which components are compiled into your custom collector.

### Add Bindplane Components to the Manifest

Update `manifest.yaml` to include the Bindplane extension and processors.

#### Extensions

```yaml
extensions:
  - gomod:
      github.com/observiq/bindplane-otel-collector/extension/bindplaneextension v1.91.0
```

#### Processors

```yaml
processors:
  - gomod:
      github.com/observiq/bindplane-otel-collector/processor/snapshotprocessor v1.91.0
  - gomod:
      github.com/observiq/bindplane-otel-collector/processor/throughputmeasurementprocessor v1.91.0
  - gomod:
      github.com/observiq/bindplane-otel-collector/processor/topologyprocessor v1.91.0
```

Ensure the Bindplane component versions align with your selected collector version.

#### Distribution metadata

```yaml
dist:
  name: otelcol-contrib-bp
  description: OpenTelemetry Collector Contrib with Bindplane
  version: 0.1.0
  otelcol_version: 0.143.0
  output_path: ./_build
```

#### Complete manifest.yaml file sample

```yaml
extensions:
  - gomod: github.com/observiq/bindplane-otel-collector/extension/bindplaneextension v1.91.0
  # ... other extensions

processors:
  - gomod: github.com/observiq/bindplane-otel-collector/processor/snapshotprocessor v1.91.0
  - gomod: github.com/observiq/bindplane-otel-collector/processor/throughputmeasurementprocessor v1.91.0
  - gomod: github.com/observiq/bindplane-otel-collector/processor/topologyprocessor v1.91.0
  # ... other processors

# Example for the 'dist' section:
dist:
  name: otelcol-contrib-bp
  description: OpenTelemetry Collector Contrib w/ Bindplane
  version: 0.1.0
  otelcol_version: 0.143.0
  output_path: ./_build
```

### Build the Custom Collector

Run OCB with your manifest:

```bash
./ocb --config manifest.yaml
```

This produces a custom collector binary. This example will produce `otelcol-contrib-bp` since that is the value of `dist.name` in the `manifest.yaml`.

### Download the OpAMP Supervisor

The OpAMP Supervisor is a standalone executable binary that manages the collector process and handles communication with Bindplane.

Download the OpAMP Supervisor binary that matches your collector version from the [OpenTelemetry Collector Releases](https://github.com/open-telemetry/opentelemetry-collector-releases/releases).

### Configure the OpAMP Supervisor

Create a file named `supervisor.yaml` to configure the connection to Bindplane.

* `server.endpoint`: Set the endpoint to the Bindplane OpAMP server.
* `server.headers.Authorization`: Set the Authorization header using your Bindplane Secret Key.
* `agent.executable`: Point the executable to the custom collector you built with OCB.

```yaml
server:
  endpoint: wss://app.bindplane.com/v1/opamp
  headers:
    Authorization: "Secret-Key <BINDPLANE_SECRET_KEY>"
  tls:
    insecure: false
    insecure_skip_verify: false

capabilities:
  accepts_remote_config: true
  reports_remote_config: true
  reports_available_components: true

agent:
  executable: ./otelcol-contrib-bp
  config_apply_timeout: 30s
  bootstrap_timeout: 5s

storage:
  directory: .
```

#### Optional: Enable local collector logging

To persist collector logs locally, reference an additional config file:

```yaml
agent:
  executable: ./otelcol-contrib-bp
  config_apply_timeout: 30s
  bootstrap_timeout: 5s
  config_files:
    - $OPAMP_EXTENSION_CONFIG
    - logging.yaml
    - $REMOTE_CONFIG
```

Create `logging.yaml`:

```yaml
service:
  telemetry:
    logs:
      level: info
      encoding: json
      disable_stacktrace: true
      sampling:
        enabled: false
      output_paths:
        - collector.log
      error_output_paths:
        - collector.log
```

### Run the Supervisor and Collector

Start the system by running the OpAMP Supervisor:

```bash
./opampsupervisor --config ./supervisor.yaml
```

The supervisor will:

* Launch your custom collector
* Register it with Bindplane
* Apply remote configuration updates automatically

Once connected, the collector appears in Bindplane and is fully managed through the platform.


---

# 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/how-to-guides/collector-management/bring-your-own-collector/connect-opentelemetry-collectors-using-the-opamp-supervisor.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.
