Skip to content

chagui/besreceiver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

besreceiver

CI Go Reference Go Report Card Stability: Alpha

An OpenTelemetry Collector custom receiver designed to receive Bazel Build Event Protocol (BEP) streams via the BES gRPC API and converts them into the OpenTelemetry trace model. Bazel builds become trace flamegraphs in Datadog, Tempo, Jaeger, or any OTLP backend.

End-to-end pipeline: Bazel CLI → besreceiver (inside OTel Collector) → batch processor + OTLP exporter → Datadog / Tempo / Jaeger

Quick start

Build the custom collector

# Install the OpenTelemetry Collector Builder (OCB)
go install go.opentelemetry.io/collector/cmd/builder@v0.146.1

# Build the collector binary
make ocb

Run it

./build/otelcol-bazel --config collector-config.yaml

Point Bazel at it

bazel build //... \
  --bes_backend=grpc://localhost:8082 \
  --build_event_publish_all_actions

The --build_event_publish_all_actions flag is required -- without it, only failed actions emit events.

Trace output

Each Bazel invocation produces one trace:

bazel.build (root span, traceID derived from invocation UUID)
├── bazel.target (//pkg:lib)
│   ├── bazel.action (Javac)
│   └── bazel.action (Turbine)
├── bazel.target (//pkg:test)
│   ├── bazel.test (shard=0, run=1, attempt=1)
│   └── bazel.test (shard=1, run=1, attempt=1)
└── bazel.metrics (wall_time, cpu_time, actions_executed)

Configuration

The receiver is configured under receivers.bes in the collector YAML. It embeds the standard configgrpc.ServerConfig (endpoint, TLS, keepalive) plus BES-specific tuning parameters (invocation_timeout, reaper_interval). See collector-config.yaml for a working example and config.go for the full schema.

Development

make test       # Run tests (with race detector, no cache)
make lint       # Run golangci-lint
make vet        # Run go vet
make build      # Verify compilation
make ci         # Run the full CI chain: vet → lint → test → build
make test-bench # Run benchmarks
make fuzz       # Run fuzz tests

Optional: install the prek git hooks to lint staged Go packages on commit and the full module on push (CI remains the source of truth):

make pre-commit-install   # cargo binstall prek + wire up commit & push hooks
make pre-commit           # fast: lint changed packages
make pre-push             # slow: lint the whole root module

Documentation

License

See LICENSE.

About

OpenTelemetry Collector receiver for Bazel Build Event Protocol (BES) — turns Bazel builds into distributed traces

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages