agentsclimarketplace

Otel collector builder

Skill ollygarden/opentelemetry-agent-skills/skills/otel-collector-builder

Build custom OpenTelemetry Collector distributions with OCB (OpenTelemetry Collector Builder). Use when authoring or debugging a builder manifest (builder.yaml), choosing component and provider versions, building a collector that bundles a custom or out-of-distribution component, setting up CI or Docker builds of a distribution, or troubleshooting OCB build failures. Triggers on "ocb", "collector builder", "custom collector distribution", "builder manifest", "builder-config", and version-mismatch errors from OCB builds.From its SKILL.md

Install
npx -y skills add ollygarden/opentelemetry-agent-skills --skill otel-collector-builder

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

SKILL.md

7.1 KB, as published. Nobody here has run it

OpenTelemetry Collector Builder (OCB)

OCB generates and compiles a custom Collector binary from a YAML manifest that lists exactly the components to include. Source of truth: cmd/builder in opentelemetry-collector.

Use OCB when the stock otelcol/otelcol-contrib distributions don't fit: you need a component that ships in no distribution, a private/local component, or a slimmer binary with only the components you run.

This skill covers building the distribution. For configuring individual components, see otel-collector; for writing a new component, see the component-authoring guidance; for generating test traffic against the built binary, see otel-telemetrygen.

Workflow

  1. Install OCB at the version matching your target Collector version (see Install).
  2. Write the manifest — dist: block plus component lists. Start from the minimal manifest; full key reference in references/manifest.md.
  3. Align versions. All core components share one v0.x.0 version, contrib components use the same v0.x.0, and confmap providers use the paired stable v1.y.0. Getting this wrong is the #1 build failure — see Version alignment.
  4. Build with ocb --config=builder.yaml (binary is named builder when installed via go install). CI, Docker, multi-arch, and local-component workflows are in references/workflows.md.
  5. Verify: run ./dist/<name> validate --config=<collector-config>.yaml, then start it and send test data (otel-telemetrygen skill). If the build fails, see references/troubleshooting.md.

Install

Pick the OCB version equal to the Collector core version you're targeting.

# Release binary (named ocb): https://github.com/open-telemetry/opentelemetry-collector-releases/releases?q=cmd/builder
# Go install (binary is named `builder`, not `ocb`):
go install go.opentelemetry.io/collector/cmd/[email protected]

The commands below use ocb, the release-archive binary name. If you install with go install, invoke the same commands as builder ... instead.

ocb init (experimental) scaffolds a new distribution repo — manifest, Makefile, sample config, README — in --path (default .).

Minimal manifest

# builder.yaml
dist:
  name: otelcol-custom
  description: Custom OpenTelemetry Collector distribution
  output_path: ./dist
  version: 1.0.0

receivers:
  - gomod: go.opentelemetry.io/collector/receiver/otlpreceiver v0.158.0

processors:
  - gomod: go.opentelemetry.io/collector/processor/batchprocessor v0.158.0

exporters:
  - gomod: go.opentelemetry.io/collector/exporter/otlpexporter v0.158.0
  - gomod: go.opentelemetry.io/collector/exporter/debugexporter v0.158.0

providers:
  - gomod: go.opentelemetry.io/collector/confmap/provider/fileprovider v1.64.0
  - gomod: go.opentelemetry.io/collector/confmap/provider/envprovider v1.64.0

providers: semantics. Omitting the key entirely keeps OCB's built-in default set (env, file, http, https, yaml at the paired stable version). But setting providers: at all replaces that set. The generated Collector defaults conf_resolver.default_uri_scheme to env, so an explicit list without envprovider fails configuration validation unless you set another included provider as the default. Either omit the key, or include envprovider plus every scheme the collector's config will use.

Contrib components use the same list syntax:

processors:
  - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/processor/tailsamplingprocessor v0.158.0

Version alignment

Two version streams exist and must be paired:

StreamModulesExample
v0.x.0OCB itself, all core components (go.opentelemetry.io/collector/...), all contrib componentsv0.158.0
v1.y.0 (stable)confmap providers (confmap/provider/...), other 1.x modules (pdata, etc.)v1.64.0

Rules:

  • Use the same v0.x.0 for every core and contrib component, matched to the OCB version.
  • The paired provider version for a given release is authoritative in that release's embedded default manifest: https://github.com/open-telemetry/opentelemetry-collector/blob/cmd/builder/v0.158.0/cmd/builder/internal/config/default.yaml — check it rather than guessing (for v0.158.0 it is v1.64.0).
  • Versions require the v prefix (v0.158.0, not 0.158.0).
  • --skip-strict-versioning defaults to true, so mismatches surface as Go module resolution errors, not friendly OCB errors. Align versions up front instead of debugging go mod tidy output.

Build commands and flags

ocb --config=builder.yaml                                  # full build: generate + go mod tidy + compile
ocb --config=builder.yaml --skip-compilation               # generate sources only (two-stage CI)
ocb --config=builder.yaml --skip-generate --skip-get-modules  # compile pre-generated sources untouched
FlagDefaultPurpose
--configembedded default manifestManifest path. With no --config, OCB builds otelcorecol, a minimal test-only distribution.
--skip-generatefalseDon't regenerate Go sources
--skip-compilationfalseGenerate sources, don't compile
--skip-get-modulesfalseDon't run go mod tidy/downloads. Since v0.154.0 also leaves go.mod unregenerated.
--skip-strict-versioningtrueSet to false to make OCB verify resolved versions against the manifest
--ldflags / --gcflags—Extra go build flags
--verbosefalseLog the underlying Go commands

Generated output in output_path: main.go, components.go, main_others.go, main_windows.go, go.mod, go.sum, and the compiled binary named dist.name. By default binaries are stripped (-s -w); set dist.debug_compilation: true for Delve-friendly builds.

Reference files

  • references/manifest.md — every manifest key: dist: fields, component spec (gomod/import/name/path), providers, replaces, excludes, conf_resolver, telemetry
  • references/workflows.md — local component development, CI two-stage builds, Docker and multi-arch builds, relationship to opentelemetry-collector-releases
  • references/troubleshooting.md — version mismatches, module conflicts, CGO, missing providers, runtime failures

What ships with it: 3 files

18.3 KB alongside SKILL.md

references/

Gives 0 of the 12 instructions most debug triage skills give

Counted across 1,020 of the 1,639 authors here whose files we hold, read 2026-09-06

  • Find root cause before attempting any fixin 134 of 1020, across 118 files
  • Create a failing test case before implementing a fixin 109 of 1020, across 95 files
  • Read error messages and stack traces completelyin 102 of 1020, across 88 files
  • Reproduce the issue consistently before investigatingin 90 of 1020, across 77 files
  • Make the smallest possible change to test a hypothesisin 90 of 1020, across 76 files
  • Trace data flow backward to find the sourcein 84 of 1020, across 70 files
  • Form a single hypothesis before testingin 78 of 1020, across 64 files
  • Implement only one fix at a timein 76 of 1020, across 63 files
  • Question the architecture if three fixes failin 73 of 1020, across 59 files
  • Add diagnostic instrumentation at component boundariesin 68 of 1020, across 56 files
  • Compare broken code against working examplesin 68 of 1020, across 57 files
  • Write a regression test before applying the fixin 62 of 1020, across 55 files

Said here and by no other author read

  • install OCB matching the target collector version
  • write a manifest listing required components
  • align core and contrib component versions
  • align confmap provider versions with stable releases
  • use the v prefix for all versions
  • run ocb with the builder manifest

Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once.

Keep looking

Skills are one crate of 626,194. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.