Skip to content

feat(lifecycle): emit putBucketIndexesFailed metric on index creation errors#2750

Closed
delthas wants to merge 1 commit into
development/9.4from
improvement/ZENKO-5286/handle-index-creation-failures
Closed

feat(lifecycle): emit putBucketIndexesFailed metric on index creation errors#2750
delthas wants to merge 1 commit into
development/9.4from
improvement/ZENKO-5286/handle-index-creation-failures

Conversation

@delthas

@delthas delthas commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a dedicated metric tag (putBucketIndexesFailed) when the conductor's putBucketIndexes call returns an error. Provides the Prometheus signal that ZENKO-5285's "lifecycle index creation failing repeatedly" alert will hook into.

Why

Today the error callback at LifecycleConductor.js:339-345 just logs a warning and falls back to v1. There's no metric for the failure itself — only putBucketIndexes is emitted (before the call) which counts attempts. No way to alert on a sustained failure rate.

Implementation

One-line change in the conductor's error path, plus a unit test that stubs client.putBucketIndexes to fail and asserts LifecycleMetrics.onLegacyTask is called with the new tag.

The new tag is cause-agnostic — operators can dig into the warn log to find the underlying reason (MongoDB 7.1's IndexBuildKilledByOutOfDiskSpace, duplicate-name conflict, transient infra, etc.). A future ticket can map specific Arsenal errors and emit more granular tags if needed.

Existing tag semantics (unchanged)

  • putBucketIndexes — counts attempts
  • putBucketIndexesFailed (NEW) — counts failures
  • Ratio = failure rate

Related

  • BB-783 — this ticket
  • ZENKO-5286 — parent ticket that originally tracked the work ("Mongodb index creation error")
  • ZENKO-5285 — alert rule that will use the new metric
  • ARSN-588 — Arsenal functional test verifying the underlying error catching path (PR #2634)
  • ARTESCA-17683 — set indexBuildMinAvailableDiskSpaceMB=10000 in Artesca (PR #5228)
  • Parent epic ARTESCA-16740 — Empty bucket feature

Issue: BB-783

@bert-e

bert-e commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Hello delthas,

My role is to assist you with the merge of this
pull request. Please type @bert-e help to get information
on this process, or consult the user documentation.

Available options
name description privileged authored
/after_pull_request Wait for the given pull request id to be merged before continuing with the current one.
/bypass_author_approval Bypass the pull request author's approval
/bypass_build_status Bypass the build and test status
/bypass_commit_size Bypass the check on the size of the changeset TBA
/bypass_incompatible_branch Bypass the check on the source branch prefix
/bypass_jira_check Bypass the Jira issue check
/bypass_peer_approval Bypass the pull request peers' approval
/bypass_leader_approval Bypass the pull request leaders' approval
/approve Instruct Bert-E that the author has approved the pull request. ✍️
/create_pull_requests Allow the creation of integration pull requests.
/create_integration_branches Allow the creation of integration branches.
/no_octopus Prevent Wall-E from doing any octopus merge and use multiple consecutive merge instead
/unanimity Change review acceptance criteria from one reviewer at least to all reviewers
/wait Instruct Bert-E not to run until further notice.
Available commands
name description privileged
/help Print Bert-E's manual in the pull request.
/status Print Bert-E's current status in the pull request TBA
/clear Remove all comments from Bert-E from the history TBA
/retry Re-start a fresh build TBA
/build Re-start a fresh build TBA
/force_reset Delete integration branches & pull requests, and restart merge process from the beginning.
/reset Try to remove integration branches unless there are commits on them which do not appear on the source branch.

Status report is not available.

@bert-e

bert-e commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Incorrect Jira project

The Jira issue ZENKO-5286 specified in the source
branch name, does not belong to project BB.

@codecov

codecov Bot commented Jun 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.60%. Comparing base (f92d68c) to head (3f906c8).
⚠️ Report is 3 commits behind head on development/9.4.

Additional details and impacted files

Impacted file tree graph

Files with missing lines Coverage Δ
...tensions/lifecycle/conductor/LifecycleConductor.js 86.90% <100.00%> (+0.24%) ⬆️

... and 3 files with indirect coverage changes

Components Coverage Δ
Bucket Notification 80.22% <ø> (ø)
Core Library 80.61% <ø> (-0.15%) ⬇️
Ingestion 70.63% <ø> (ø)
Lifecycle 79.50% <100.00%> (+0.04%) ⬆️
Oplog Populator 85.83% <ø> (ø)
Replication 59.67% <ø> (-0.04%) ⬇️
Bucket Scanner 85.76% <ø> (ø)
@@                 Coverage Diff                 @@
##           development/9.4    #2750      +/-   ##
===================================================
- Coverage            74.65%   74.60%   -0.06%     
===================================================
  Files                  199      199              
  Lines                13654    13655       +1     
===================================================
- Hits                 10194    10187       -7     
- Misses                3450     3458       +8     
  Partials                10       10              
Flag Coverage Δ
api:retry 9.12% <0.00%> (-0.01%) ⬇️
api:routes 8.94% <0.00%> (-0.01%) ⬇️
bucket-scanner 85.76% <ø> (ø)
ft_test:queuepopulator 9.08% <0.00%> (-1.05%) ⬇️
ingestion 12.51% <0.00%> (-0.01%) ⬇️
lib 7.74% <0.00%> (-0.01%) ⬇️
lifecycle 18.88% <0.00%> (-0.01%) ⬇️
notification 1.02% <0.00%> (-0.01%) ⬇️
oplogPopulator 0.14% <0.00%> (-0.01%) ⬇️
replication 18.64% <0.00%> (-0.01%) ⬇️
unit 51.34% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@claude

claude Bot commented Jun 5, 2026

Copy link
Copy Markdown

LGTM — clean, well-scoped change. The new putBucketIndexesFailed metric follows the existing pattern (matches insufficientDiskSpace at line 323 and putBucketIndexes at line 327), the label is a fixed string with no cardinality concern, and the test properly validates the error path. No issues found.

Review by Claude Code

… error

Today the conductor's putBucketIndexes-error path just logs a warning
and falls back to v1, leaving no Prometheus signal for ZENKO-5285's
alert to fire on. Add a dedicated metric tag in the error callback so
ops can alert on sustained index-creation failures regardless of the
underlying cause (insufficient disk, server-side abort via
indexBuildMinAvailableDiskSpaceMB in MongoDB 7.1+, duplicate-name
conflict, transient infra, etc.).

The existing 'putBucketIndexes' tag continues to count attempts; the
new 'putBucketIndexesFailed' tag counts failures. The ratio is the
failure rate.

Issue: BB-783
@delthas delthas force-pushed the improvement/ZENKO-5286/handle-index-creation-failures branch from 3f906c8 to c568664 Compare June 5, 2026 12:26
@delthas delthas closed this Jun 5, 2026
@delthas delthas deleted the improvement/ZENKO-5286/handle-index-creation-failures branch June 5, 2026 12:26
@delthas delthas changed the title feat(lifecycle): emit putBucketIndexesFailed metric on index creation error feat(lifecycle): emit putBucketIndexesFailed metric on index creation errors Jun 5, 2026
@claude

claude Bot commented Jun 5, 2026

Copy link
Copy Markdown

LGTM — one-line metric addition in the existing error path, bounded label cardinality, proper test with spy cleanup via afterEach. No issues found.

Review by Claude Code

@delthas

delthas commented Jun 5, 2026

Copy link
Copy Markdown
Contributor Author

Replaced by #2751 after the source branch was renamed (improvement/ZENKO-5286/handle-index-creation-failuresimprovement/BB-783/emit-put-bucket-indexes-failed-metric). GitHub auto-closed this PR when the original branch ref was removed.

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