Skip to content

docs: document worker metrics defaults and AddWorkerRunOptions#83

Merged
ankurs merged 5 commits intomainfrom
docs/worker-metrics-coldbrew-integration
May 1, 2026
Merged

docs: document worker metrics defaults and AddWorkerRunOptions#83
ankurs merged 5 commits intomainfrom
docs/worker-metrics-coldbrew-integration

Conversation

@ankurs
Copy link
Copy Markdown
Member

@ankurs ankurs commented Apr 30, 2026

Summary

  • Adds a Metrics subsection under "ColdBrew Integration" in howto/workers.md documenting:
    • Core wires workers.NewPrometheusMetrics(APP_NAME) automatically — no extra wiring needed.
    • The default is skipped when DISABLE_PROMETHEUS=true or APP_NAME is empty.
    • How to override with core.AddWorkerRunOptions(workers.WithMetrics(m)) for custom backends (Datadog, StatsD) or other run-level options (WithDefaultJitter, WithInterceptors).
  • Tracks the API addition in go-coldbrew/core#87. This PR should land after that one merges, since it references the new public function.

Test plan

  • Build the Jekyll site locally and confirm the new subsection renders correctly under "ColdBrew Integration".
  • cd docs.coldbrew.cloud && npx playwright test — no anchor or permalink changes were made, so navigation tests should be unaffected.

Summary by CodeRabbit

  • Documentation
    • Added two opt-in ColdBrew integration sections: default Prometheus worker metrics (can be disabled or renamed) and how to override metrics backend/namespace.
    • Clarified that worker observability middleware is not auto-wired for ColdBrew and added init-time examples for enabling and composing interceptors.

Adds a Metrics subsection under ColdBrew Integration explaining that core
wires workers.NewPrometheusMetrics(APP_NAME) automatically when APP_NAME
is set and DISABLE_PROMETHEUS is not, and how to override via
core.AddWorkerRunOptions for custom metrics backends or run-level options.

Tracks go-coldbrew/core#87.
Copilot AI review requested due to automatic review settings April 30, 2026 06:38
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 30, 2026

Warning

Rate limit exceeded

@ankurs has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 2 minutes and 25 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0caa5fc8-f141-447d-bfdf-f4f7881d6d43

📥 Commits

Reviewing files that changed from the base of the PR and between 191aeb2 and f10bbf4.

📒 Files selected for processing (1)
  • howto/workers.md
📝 Walkthrough

Walkthrough

Adds two opt-in ColdBrew documentation sections: automatic Prometheus worker metrics enabled by CBWorkerProvider (configurable namespace and opt-out) and guidance for wiring worker observability middleware (Recover, LogContext, Tracing, Slog) via core.AddWorkerRunOptions and workers.WithInterceptors, including run-level vs worker-level composition rules.

Changes

Cohort / File(s) Summary
Worker Configuration Documentation
howto/workers.md
Added opt-in ColdBrew integration details: default Prometheus metrics enabled when using CBWorkerProvider (uses APP_NAME as namespace unless empty or DISABLE_PROMETHEUS=true), instructions to override metrics backend/namespace via core.AddWorkerRunOptions(workers.WithMetrics(...)) while preserving per-worker WithMetrics overrides, and examples/guidance showing that observability interceptors (Recover, LogContext, Tracing, Slog) are not auto-wired and must be enabled with core.AddWorkerRunOptions(workers.WithInterceptors(...)), including subset selection and note that run-level interceptors wrap outside worker-level interceptors.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • #80 — Edits the same howto/workers.md ColdBrew integration content and overlaps on CBWorkerProvider guidance.
  • #81 — Adjusts Tracing/observability behavior in howto/workers.md, related to the tracing sampling/behavior notes in this PR.
  • #56 — Introduced the original howto/workers.md that this change extends with metrics and interceptor wiring guidance.

Poem

🐰 I hopped through docs with care,
Metrics blooming in the air,
Interceptors set in line,
Workers hum — observability fine.
Hop, hop — the README's bare no more!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main changes: documenting worker metrics defaults and the AddWorkerRunOptions function in the ColdBrew integration documentation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/worker-metrics-coldbrew-integration

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
Review rate limit: 0/1 reviews remaining, refill in 2 minutes and 25 seconds.

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

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the workers documentation to describe ColdBrew core’s default worker metrics wiring and how to override it using the new core.AddWorkerRunOptions API, aligning docs with the upcoming core change.

Changes:

  • Adds a new “Metrics” subsection under “ColdBrew Integration” explaining the default workers.NewPrometheusMetrics(APP_NAME) behavior and when it is skipped.
  • Documents overriding the run-level default metrics (and other worker run options) via core.AddWorkerRunOptions(...).

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

Comment thread howto/workers.md Outdated
Comment thread howto/workers.md Outdated
ankurs added 2 commits April 30, 2026 15:17
- rename "### Metrics" to "### Metrics defaults" so the anchor doesn't
  collide with the existing "## Metrics" earlier in the document
- update the in-text reference to be unambiguous
- pass &myDatadogMetrics{} (pointer) to match the pointer-receiver
  example shown earlier in the same document
…ontext)

Add a "Tracing and observability middleware (opt-in)" subsection to the
ColdBrew Integration section explaining that core does not wire workers
middleware automatically and showing the AddWorkerRunOptions one-liner
to enable middleware.DefaultInterceptors() — plus a conservative subset
(Recover + LogContext) for fast-tick workers where per-cycle spans/logs
would be noisy.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds documentation clarifying ColdBrew’s default worker metrics behavior and how to customize worker run-level options when integrating workers via CBWorkerProvider.

Changes:

  • Added a “Metrics defaults” subsection under “ColdBrew Integration” explaining default Prometheus worker metrics wiring and when it is skipped.
  • Documented overriding defaults via core.AddWorkerRunOptions(...) (custom metrics backends, jitter, interceptors).
  • Added an opt-in “Tracing and observability middleware” subsection showing how to enable worker middleware framework-wide.

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

Comment thread howto/workers.md Outdated
Comment thread howto/workers.md Outdated
- core.Run() -> cb.Run() to match the canonical entrypoint shown
  elsewhere in the docs (cb := core.New(cfg); cb.Run())
- "behaviour" -> "behavior" for consistency with the rest of the page
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds documentation to the Workers how-to clarifying ColdBrew’s default worker metrics wiring and how to override worker run options when using CBWorkerProvider.

Changes:

  • Documented default Prometheus worker metrics behavior (namespace via APP_NAME, skip conditions).
  • Added examples for overriding metrics backend / namespace via core.AddWorkerRunOptions(workers.WithMetrics(...)).
  • Added an opt-in section showing how to enable worker observability interceptors at the run level.

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

Comment thread howto/workers.md Outdated
The middleware section earlier in this document describes Slog as
emitting two log lines per cycle (start + end/error). The new opt-in
section was paraphrasing as "one log line per cycle" — update to match.
@ankurs ankurs merged commit 81ad888 into main May 1, 2026
7 checks passed
@ankurs ankurs deleted the docs/worker-metrics-coldbrew-integration branch May 1, 2026 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants