ANA-7386 Add Protorabbit instrumentor - #41
Conversation
protorabbit worker processes ran no embedded Prometheus exporter server, so any metric pushed from inside message processing (e.g. gRPC client interceptor metrics) was refused with Errno::ECONNREFUSED on /send-metrics and silently dropped. Adds Instrumentors::Protorabbit, following the existing Hutch instrumentor pattern minus the tracer/middleware wiring that protorabbit has no hook for, plus protorabbit_collectors/protorabbit_type_collectors configuration.
There was a problem hiding this comment.
Pull request overview
Adds opt-in Protorabbit worker instrumentation so Prometheus metrics can reach an embedded exporter.
Changes:
- Adds and tests the Protorabbit instrumentor.
- Adds collector configuration and integration documentation.
- Releases the feature as version 0.9.0.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
lib/bigcommerce/prometheus/instrumentors/protorabbit.rb |
Implements exporter startup and collector registration. |
spec/bigcommerce/prometheus/instrumentors/protorabbit_spec.rb |
Tests startup, configuration, disabled behavior, and failures. |
lib/bigcommerce/prometheus/configuration.rb |
Adds Protorabbit collector settings. |
lib/bigcommerce/prometheus.rb |
Loads the new instrumentor. |
README.md |
Documents setup and configuration. |
CHANGELOG.md |
Records the new feature. |
lib/bigcommerce/prometheus/version.rb |
Bumps the gem to 0.9.0. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 61ca592c05
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Jira: ANA-7386
What/Why?
Protorabbit processes have no Prometheus instrumentor, so the exporter server never starts and any metrics pushed during message processing fail with
Errno::ECONNREFUSED. This is confirmed in theme-registry, auth, bmp, and bigpay, so the fix lives here rather than in each service individually.Changes:
lib/bigcommerce/prometheus/instrumentors/protorabbit.rb— newProtorabbitinstrumentor; starts the exporter server, registers the built-inActiveRecordCollector/ActiveRecordSqltype collector, then any configuredprotorabbit_collectors/protorabbit_type_collectors, mirroringHutch/Resqueminus middleware setuplib/bigcommerce/prometheus/configuration.rb— addsprotorabbit_collectors/protorabbit_type_collectorsconfig, defaulting to[]lib/bigcommerce/prometheus.rb— requires the new instrumentorREADME.md— documentsProtorabbit.new.startusage and the new config keysCHANGELOG.md,version.rb— bump to 0.9.0A few notes for reviewers:
Protorabbit.newtakes noapp:arg, unlikeHutch.new(app:)— there's no Rails app object available in a protorabbit worker context.Rollout/Rollback
Ships as a new gem version (0.9.0) with no behavior change until a consuming service calls
Bigcommerce::Prometheus::Instrumentors::Protorabbit.new.startin its protorabbit boot code. Existing Web/Resque/Hutch instrumentation is untouched.Rollback is a plain gem downgrade; no data or schema is involved. Consuming services (theme-registry, auth, bmp, bigpay) need a follow-up change to actually wire in
.start— that adoption is out of scope here.Testing
Automated:
spec/bigcommerce/prometheus/instrumentors/protorabbit_spec.rb— covers disabled-noop, enabled start (registersActiveRecordCollector, registers the ActiveRecord SQL type collector, registers configured type collector last so it can override, starts server, starts collectors), and rescue-and-log on server start failurebundle exec rspec spec/bigcommerce/prometheus/instrumentors/protorabbit_spec.rbManual verification:
Before fix (no
.startcall) — reproduces the exact bug from ANA-7386:After fix (
Protorabbit.new.startcalled, then a metric pushed viaBigcommerce::Prometheus.client):Exporter starts, registers collectors, and serves the pushed metric on
/metrics— no connection refused.Manual checklist for reviewer:
Protorabbitsection matches the intended integration pattern for a consuming serviceNote
Low Risk
Opt-in at call sites via
.start; mirrors existing Hutch/Resque server startup with no change to Web/Resque/Hutch until services wire it in.Overview
Adds
Bigcommerce::Prometheus::Instrumentors::Protorabbitso protorabbit (RabbitMQ protobuf consumer) workers can start the same embedded Prometheus exporter used by Web/Resque/Hutch. Without it, metrics pushed during message handling hitErrno::ECONNREFUSEDon/send-metricsbecause nothing listens on the exporter port.Call
Protorabbit.new.startin protorabbit boot code (noapp:argument—unlike Hutch). The instrumentor registersActiveRecordCollector, the ActiveRecord SQL type collector, configuredprotorabbit_collectors/protorabbit_type_collectors, then starts the server and polling collectors. It does not wrap message processing (no Hutch-style middleware); it only enables ingestion of metrics already emitted from handlers (e.g. gRPC client interceptors).Configuration adds
protorabbit_collectorsandprotorabbit_type_collectors(default[]). Gem version bumps to 0.9.0 with CHANGELOG/README updates and a newprotorabbit_speccovering disabled noop, enabled startup order, and error rescue.Reviewed by Cursor Bugbot for commit 61ca592. Bugbot is set up for automated code reviews on this repo. Configure here.