Skip to content

Replace Ruby bosh-monitor with Go implementation#2747

Draft
aramprice wants to merge 1 commit into
mainfrom
experiment-golang-bosh-monitor
Draft

Replace Ruby bosh-monitor with Go implementation#2747
aramprice wants to merge 1 commit into
mainfrom
experiment-golang-bosh-monitor

Conversation

@aramprice

Copy link
Copy Markdown
Member

Summary

This PR replaces the Ruby bosh-monitor implementation with a new Go-based binary that provides the same functionality, including:

  • NATS subscription for agent heartbeats, alerts, and shutdown events
  • Director polling for deployment/instance synchronization
  • Plugin host architecture with out-of-process plugins (hm-logger, hm-resurrector, hm-event-logger, hm-datadog, hm-pagerduty, hm-riemann, hm-graphite, hm-email, hm-consul, hm-json, hm-tsdb)
  • HTTP API (healthz, unresponsive_agents, unhealthy_agents, etc.)
  • TLS peer verification for Director and UAA connections
  • NATS connection retry logic during startup
  • director_ca_cert / uaa_ca_cert support for CA-bundle TLS

Changes

  • src/bosh-monitor/: Delete Ruby source (lib/, spec/, bin/, gemspec). Add Go implementation.
  • src/Gemfile / src/Gemfile.lock: Remove bosh-monitor gem.
  • .github/workflows/go.yml: Add bosh-monitor-lint and bosh-monitor-test jobs.
  • .github/workflows/ruby.yml: Remove monitor:parallel matrix entry (Ruby code deleted).
  • jobs/health_monitor/: Switch from Ruby runtime to Go binary; remove director-ruby-3.3 package dep.
  • packages/health_monitor/: Replace gem build script with go build.
  • src/spec/integration_support/: Add BoshMonitorManager to build the Go binary for integration tests; update sandbox to use it with correct PATH.
  • src/spec/assets/sandbox/: Update sandbox HM configs to be compatible with Go config format.
  • src/spec/integration/health_monitor/: Update JSON heartbeat log parsing to match Go slog format.

Test plan

  • Go unit tests: cd src/bosh-monitor && go test ./... — all pass locally
  • fly:integration submitted: build #363518081
  • GitHub Actions go workflow: bosh-monitor-test and bosh-monitor-lint jobs
  • GitHub Actions ruby workflow: nats_sync:parallel, common:parallel, release (no longer tests deleted Ruby monitor)

@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 1244295a-02c1-4268-a49f-666828b0b1e0

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch experiment-golang-bosh-monitor

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Comment thread .github/workflows/go.yml Fixed
Comment thread .github/workflows/go.yml Fixed
Comment thread src/bosh-monitor/main.go Fixed
@aramprice aramprice force-pushed the experiment-golang-bosh-monitor branch from e611365 to 56da280 Compare June 19, 2026 23:43
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 19, 2026
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 19, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR replaces the legacy Ruby-based bosh-monitor with a Go-based implementation and updates packaging, CI, and integration test scaffolding to build and run the new binary + out-of-process plugins.

Changes:

  • Introduces a new Go bosh-monitor binary with supporting packages (server, event processing, NATS monitoring, plugin host/protocol, etc.) and Ginkgo/Gomega tests.
  • Updates BOSH release packaging/job templates to run the Go binary instead of the Ruby runtime/gem.
  • Updates integration support to build the Go binary/plugins and adjusts integration specs/configs for the new log/config formats.

Reviewed changes

Copilot reviewed 156 out of 160 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
src/spec/integration/health_monitor/hm_stateless_spec.rb Updates integration log parsing to match Go slog output format.
src/spec/integration_support/sandbox.rb Builds the Go monitor for integration tests and runs it with updated PATH/env.
src/spec/integration_support/bosh_monitor_manager.rb Adds integration helper to build Go bosh-monitor + plugin binaries.
src/spec/assets/sandbox/health_monitor_without_resurrector.yml.erb Adjusts sandbox HM config to match new Go monitor expectations.
src/Gemfile.lock Removes Ruby bosh-monitor gem from bundle.
src/Gemfile Removes Ruby bosh-monitor gem entry.
src/bosh-monitor/test/integration/integration_suite_test.go Adds Go integration test suite scaffold (Ginkgo).
src/bosh-monitor/spec/unit/bosh/monitor/protocols/tcp_connection_spec.rb Removes Ruby monitor unit tests (legacy implementation removed).
src/bosh-monitor/spec/unit/bosh/monitor/plugins/tsdb_spec.rb Removes Ruby monitor unit tests (legacy implementation removed).
src/bosh-monitor/spec/unit/bosh/monitor/plugins/riemann_spec.rb Removes Ruby monitor unit tests (legacy implementation removed).
src/bosh-monitor/spec/unit/bosh/monitor/plugins/resurrector_helper_spec.rb Removes Ruby monitor unit tests (legacy implementation removed).
src/bosh-monitor/spec/unit/bosh/monitor/plugins/paging_datadog_client_spec.rb Removes Ruby monitor unit tests (legacy implementation removed).
src/bosh-monitor/spec/unit/bosh/monitor/plugins/pagerduty_spec.rb Removes Ruby monitor unit tests (legacy implementation removed).
src/bosh-monitor/spec/unit/bosh/monitor/plugins/logger_spec.rb Removes Ruby monitor unit tests (legacy implementation removed).
src/bosh-monitor/spec/unit/bosh/monitor/plugins/json_spec.rb Removes Ruby monitor unit tests (legacy implementation removed).
src/bosh-monitor/spec/unit/bosh/monitor/plugins/graphite_spec.rb Removes Ruby monitor unit tests (legacy implementation removed).
src/bosh-monitor/spec/unit/bosh/monitor/plugins/event_logger_spec.rb Removes Ruby monitor unit tests (legacy implementation removed).
src/bosh-monitor/spec/unit/bosh/monitor/plugins/email_spec.rb Removes Ruby monitor unit tests (legacy implementation removed).
src/bosh-monitor/spec/unit/bosh/monitor/plugins/dummy_spec.rb Removes Ruby monitor unit tests (legacy implementation removed).
src/bosh-monitor/spec/unit/bosh/monitor/plugins/base_spec.rb Removes Ruby monitor unit tests (legacy implementation removed).
src/bosh-monitor/spec/unit/bosh/monitor/metric_spec.rb Removes Ruby monitor unit tests (legacy implementation removed).
src/bosh-monitor/spec/unit/bosh/monitor/instance_spec.rb Removes Ruby monitor unit tests (legacy implementation removed).
src/bosh-monitor/spec/unit/bosh/monitor/events/base_spec.rb Removes Ruby monitor unit tests (legacy implementation removed).
src/bosh-monitor/spec/unit/bosh/monitor/events/alert_spec.rb Removes Ruby monitor unit tests (legacy implementation removed).
src/bosh-monitor/spec/unit/bosh/monitor/event_processor_spec.rb Removes Ruby monitor unit tests (legacy implementation removed).
src/bosh-monitor/spec/unit/bosh/monitor/director_monitor_spec.rb Removes Ruby monitor unit tests (legacy implementation removed).
src/bosh-monitor/spec/unit/bosh/monitor/config_spec.rb Removes Ruby monitor unit tests (legacy implementation removed).
src/bosh-monitor/spec/unit/bosh/monitor/agent_spec.rb Removes Ruby monitor unit tests (legacy implementation removed).
src/bosh-monitor/spec/support/uaa_helpers.rb Removes Ruby monitor test support (legacy implementation removed).
src/bosh-monitor/spec/support/host_authorizatin.rb Removes Ruby monitor test support (legacy implementation removed).
src/bosh-monitor/spec/support/buffered_logger.rb Removes Ruby monitor test support (legacy implementation removed).
src/bosh-monitor/spec/spec_helper.rb Removes Ruby monitor spec helper (legacy implementation removed).
src/bosh-monitor/spec/gemspec_spec.rb Removes Ruby gemspec tests (legacy implementation removed).
src/bosh-monitor/spec/functional/notifying_plugins_spec.rb Removes Ruby functional tests (legacy implementation removed).
src/bosh-monitor/spec/assets/sample_config.yml Removes Ruby sample config (legacy implementation removed).
src/bosh-monitor/spec/assets/dummy_plugin_config.yml Removes Ruby dummy plugin config (legacy implementation removed).
src/bosh-monitor/pkg/server/server.go Adds Go HTTP API server implementation (healthz + agent endpoints).
src/bosh-monitor/pkg/server/server_test.go Adds Go tests for server endpoints.
src/bosh-monitor/pkg/server/server_suite_test.go Adds Ginkgo suite for server package.
src/bosh-monitor/pkg/resurrection/resurrection_suite_test.go Adds Ginkgo suite for resurrection package.
src/bosh-monitor/pkg/resurrection/manager_test.go Adds resurrection manager rule parsing/behavior tests.
src/bosh-monitor/pkg/processor/processor_suite_test.go Adds Ginkgo suite for processor package.
src/bosh-monitor/pkg/processor/event_processor.go Adds Go event processor (validation, dedupe, pruning, dispatch).
src/bosh-monitor/pkg/processor/event_processor_test.go Adds tests for Go event processor.
src/bosh-monitor/pkg/pluginproto/protocol_suite_test.go Adds Ginkgo suite for plugin protocol package.
src/bosh-monitor/pkg/pluginhost/pluginhost_suite_test.go Adds Ginkgo suite for plugin host package.
src/bosh-monitor/pkg/pluginhost/host_test.go Adds tests for plugin host command handling and startup behavior.
src/bosh-monitor/pkg/nats/nats_suite_test.go Adds Ginkgo suite for NATS package.
src/bosh-monitor/pkg/nats/director_monitor.go Adds Go director-alert subscription monitor.
src/bosh-monitor/pkg/nats/director_monitor_test.go Adds initial unit tests for director monitor (needs strengthening).
src/bosh-monitor/pkg/nats/client.go Adds Go NATS client with TLS and startup retry logic.
src/bosh-monitor/pkg/instance/instance.go Adds Go instance model + formatting helpers.
src/bosh-monitor/pkg/instance/instance_suite_test.go Adds Ginkgo suite for instance package.
src/bosh-monitor/pkg/instance/deployment.go Adds Go deployment model and agent/instance bookkeeping.
src/bosh-monitor/pkg/instance/agent.go Adds Go agent model and timeout/rogue logic.
src/bosh-monitor/pkg/events/metric.go Adds Go metric model.
src/bosh-monitor/pkg/events/events_suite_test.go Adds Ginkgo suite for events package.
src/bosh-monitor/pkg/events/base.go Adds Go event factory/validation helpers.
src/bosh-monitor/pkg/director/director_suite_test.go Adds Ginkgo suite for director package.
src/bosh-monitor/pkg/director/auth.go Adds Go auth provider logic (basic + UAA token flow, CA selection).
src/bosh-monitor/pkg/config/config.go Adds Go config loader with defaults/validation.
src/bosh-monitor/pkg/config/config_suite_test.go Adds Ginkgo suite for config package.
src/bosh-monitor/main.go Adds Go entrypoint (-c config) with slog logging and signal handling.
src/bosh-monitor/lib/bosh/monitor/yaml_helper.rb Removes Ruby monitor implementation (deleted).
src/bosh-monitor/lib/bosh/monitor/version.rb Removes Ruby monitor implementation (deleted).
src/bosh-monitor/lib/bosh/monitor/resurrection_manager.rb Removes Ruby monitor implementation (deleted).
src/bosh-monitor/lib/bosh/monitor/protocols/tsdb_connection.rb Removes Ruby monitor implementation (deleted).
src/bosh-monitor/lib/bosh/monitor/protocols/tcp_connection.rb Removes Ruby monitor implementation (deleted).
src/bosh-monitor/lib/bosh/monitor/protocols/graphite_connection.rb Removes Ruby monitor implementation (deleted).
src/bosh-monitor/lib/bosh/monitor/plugins/tsdb.rb Removes Ruby monitor implementation (deleted).
src/bosh-monitor/lib/bosh/monitor/plugins/riemann.rb Removes Ruby monitor implementation (deleted).
src/bosh-monitor/lib/bosh/monitor/plugins/resurrector_helper.rb Removes Ruby monitor implementation (deleted).
src/bosh-monitor/lib/bosh/monitor/plugins/README.md Removes Ruby plugin README (deleted).
src/bosh-monitor/lib/bosh/monitor/plugins/paging_datadog_client.rb Removes Ruby monitor implementation (deleted).
src/bosh-monitor/lib/bosh/monitor/plugins/pagerduty.rb Removes Ruby monitor implementation (deleted).
src/bosh-monitor/lib/bosh/monitor/plugins/logger.rb Removes Ruby monitor implementation (deleted).
src/bosh-monitor/lib/bosh/monitor/plugins/json.rb Removes Ruby monitor implementation (deleted).
src/bosh-monitor/lib/bosh/monitor/plugins/http_request_helper.rb Removes Ruby monitor implementation (deleted).
src/bosh-monitor/lib/bosh/monitor/plugins/graphite.rb Removes Ruby monitor implementation (deleted).
src/bosh-monitor/lib/bosh/monitor/plugins/event_logger.rb Removes Ruby monitor implementation (deleted).
src/bosh-monitor/lib/bosh/monitor/plugins/email.rb Removes Ruby monitor implementation (deleted).
src/bosh-monitor/lib/bosh/monitor/plugins/dummy.rb Removes Ruby monitor implementation (deleted).
src/bosh-monitor/lib/bosh/monitor/plugins/datadog.rb Removes Ruby monitor implementation (deleted).
src/bosh-monitor/lib/bosh/monitor/plugins/base.rb Removes Ruby monitor implementation (deleted).
src/bosh-monitor/lib/bosh/monitor/metric.rb Removes Ruby monitor implementation (deleted).
src/bosh-monitor/lib/bosh/monitor/instance.rb Removes Ruby monitor implementation (deleted).
src/bosh-monitor/lib/bosh/monitor/events/heartbeat.rb Removes Ruby monitor implementation (deleted).
src/bosh-monitor/lib/bosh/monitor/events/base.rb Removes Ruby monitor implementation (deleted).
src/bosh-monitor/lib/bosh/monitor/events/alert.rb Removes Ruby monitor implementation (deleted).
src/bosh-monitor/lib/bosh/monitor/event_processor.rb Removes Ruby monitor implementation (deleted).
src/bosh-monitor/lib/bosh/monitor/errors.rb Removes Ruby monitor implementation (deleted).
src/bosh-monitor/lib/bosh/monitor/director.rb Removes Ruby monitor implementation (deleted).
src/bosh-monitor/lib/bosh/monitor/director_monitor.rb Removes Ruby monitor implementation (deleted).
src/bosh-monitor/lib/bosh/monitor/deployment.rb Removes Ruby monitor implementation (deleted).
src/bosh-monitor/lib/bosh/monitor/core_ext.rb Removes Ruby monitor implementation (deleted).
src/bosh-monitor/lib/bosh/monitor/config.rb Removes Ruby monitor implementation (deleted).
src/bosh-monitor/lib/bosh/monitor/auth_provider.rb Removes Ruby monitor implementation (deleted).
src/bosh-monitor/lib/bosh/monitor/api_controller.rb Removes Ruby monitor implementation (deleted).
src/bosh-monitor/lib/bosh/monitor/agent.rb Removes Ruby monitor implementation (deleted).
src/bosh-monitor/lib/bosh/monitor.rb Removes Ruby monitor implementation (deleted).
src/bosh-monitor/go.mod Adds Go module definition for new monitor.
src/bosh-monitor/cmd/plugins/pluginlib/pluginlib.go Adds shared plugin runtime library for out-of-process plugins.
src/bosh-monitor/cmd/plugins/pluginlib/pluginlib_test.go Adds tests for plugin runtime library.
src/bosh-monitor/cmd/plugins/pluginlib/pluginlib_suite_test.go Adds Ginkgo suite for pluginlib package.
src/bosh-monitor/cmd/plugins/hm-tsdb/main.go Adds TSDB plugin (Go) implementation.
src/bosh-monitor/cmd/plugins/hm-riemann/main.go Adds Riemann plugin (Go) implementation.
src/bosh-monitor/cmd/plugins/hm-pagerduty/main.go Adds PagerDuty plugin (Go) implementation.
src/bosh-monitor/cmd/plugins/hm-logger/main.go Adds logger plugin (Go) implementation.
src/bosh-monitor/cmd/plugins/hm-json/main.go Adds JSON fanout plugin (Go) implementation.
src/bosh-monitor/cmd/plugins/hm-graphite/main.go Adds Graphite plugin (Go) implementation.
src/bosh-monitor/cmd/plugins/hm-event-logger/main.go Adds event-logger plugin (Go) implementation.
src/bosh-monitor/cmd/plugins/hm-dummy/main.go Adds dummy plugin (Go) implementation.
src/bosh-monitor/cmd/plugins/hm-datadog/main.go Adds Datadog plugin (Go) implementation.
src/bosh-monitor/.golangci.yml Adds golangci-lint config for the new Go module.
packages/health_monitor/spec Updates package spec to remove Ruby dependencies and ship new monitor sources.
packages/health_monitor/packaging Updates packaging to build Go binary + plugins.
jobs/health_monitor/templates/health_monitor Updates job launcher to run the Go binary (removes Ruby env).
jobs/health_monitor/templates/bpm.yml Updates BPM config to run Go binary with args, removes Ruby env vars/volumes.
jobs/health_monitor/spec Removes Ruby package dependency from health_monitor job.
.github/workflows/ruby.yml Removes the Ruby monitor test matrix entry.
.github/workflows/go.yml Adds lint/test jobs for the new Go bosh-monitor module.
Comments suppressed due to low confidence (1)

packages/health_monitor/spec:6

  • go build is invoked in this package, but the package spec declares no dependency that would provide a Go toolchain during BOSH compilation. Unless the compilation environment already has go available, this will fail to compile the release. Consider either (a) adding a golang-* package dependency, or (b) shipping prebuilt binaries (like other packages in this release) and removing the compile-time go build requirement.
---
name: health_monitor

files:
- bosh-monitor/**/*


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/spec/integration_support/bosh_monitor_manager.rb
Comment thread packages/health_monitor/packaging
Comment thread src/bosh-monitor/go.mod
Comment thread src/bosh-monitor/pkg/nats/director_monitor_test.go
Comment thread src/bosh-monitor/pkg/server/server_test.go
Comment thread src/bosh-monitor/pkg/server/server_test.go
Comment thread src/bosh-monitor/pkg/processor/event_processor.go Outdated
Comment thread src/bosh-monitor/cmd/plugins/hm-pagerduty/main.go
Comment thread src/bosh-monitor/cmd/plugins/hm-graphite/main.go
Comment thread src/bosh-monitor/cmd/plugins/hm-tsdb/main.go
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 20, 2026
Replace the Ruby bosh-monitor implementation with a Go-based binary.

Changes:
- Add Go bosh-monitor implementation under src/bosh-monitor/
- Delete Ruby bosh-monitor source (lib/, spec/, bin/, gemspec)
- Remove bosh-monitor gem from src/Gemfile and Gemfile.lock
- Update jobs/health_monitor/ to use Go binary (remove director-ruby-3.3 dep)
- Update packages/health_monitor/ to compile Go binary via go build
- Update .github/workflows/go.yml to test and lint src/bosh-monitor/
- Update .github/workflows/ruby.yml to remove monitor:parallel (Ruby deleted)
- Add integration test support: BoshMonitorManager builds Go binary for sandbox
- Fix hm-logger plugin output format to match Ruby logger for integration tests
- Update hm_stateless_spec.rb JSON heartbeat parsing to match Go slog format
- Fix sandbox health_monitor_without_resurrector.yml.erb (remove nats plugin)
- Ensure TLS peer verification with director_ca_cert and uaa_ca_cert
- Implement NATS connection retry logic during startup
- Align DataDog pagerduty_service_name routing with Ruby implementation
- Align Riemann severity string mapping with Ruby implementation
@aramprice aramprice force-pushed the experiment-golang-bosh-monitor branch from 541b3a6 to e6ed6f2 Compare June 20, 2026 01:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Pending Merge | Prioritized

Development

Successfully merging this pull request may close these issues.

3 participants