WPB-25915 add timeout and duration metric for conversation migration#5244
Open
battermann wants to merge 21 commits into
Open
WPB-25915 add timeout and duration metric for conversation migration#5244battermann wants to merge 21 commits into
battermann wants to merge 21 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds timeout handling and duration observability for background-worker conversation migrations to make stuck per-conversation attempts visible and fail-fast.
Changes:
- Adds optional
timeouttoMigrationOptionsand applies it to per-conversation migration attempts. - Registers and records a Prometheus histogram for conversation migration attempt durations by outcome.
- Documents the new timeout setting and updates package dependencies for
Timeouttime-unit support.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
services/background-worker/src/Wire/PostgresMigrations.hs |
Registers and passes the new conversation migration duration histogram. |
services/background-worker/src/Wire/BackgroundWorker.hs |
Updates existing MigrationOptions constructor calls for the new timeout field. |
libs/wire-subsystems/src/Wire/Migration.hs |
Adds timeout configuration and timeout exception type. |
libs/wire-subsystems/src/Wire/ConversationStore/Migration.hs |
Applies per-conversation timeout logic and records duration metrics. |
libs/types-common/types-common.cabal |
Adds polysemy-time dependency. |
libs/types-common/src/Util/Timeout.hs |
Derives TimeUnit for Timeout. |
libs/types-common/default.nix |
Adds polysemy-time to Nix dependencies. |
docs/src/developer/reference/config-options.md |
Documents the new migration timeout option. |
changelog.d/5-internal/WPB-25915 |
Adds a changelog entry file, but it is currently empty. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
akshaymankar
requested changes
Jun 2, 2026
Co-authored-by: Akshay Mankar <akshay@wire.com>
Co-authored-by: Akshay Mankar <akshay@wire.com>
Co-authored-by: Akshay Mankar <akshay@wire.com>
Co-authored-by: Akshay Mankar <akshay@wire.com>
Comment on lines
+42
to
+46
| convMigDuration <- register $ vector "outcome" $ histogram (Prometheus.Info "wire_local_convs_migration_duration_seconds_bucket" "Duration of local conversation migration attempts") defaultBuckets | ||
| userMigCounter <- register $ counter $ Prometheus.Info "wire_user_remote_convs_migrated_to_pg" "Number of users whose remote conversation membership data is migrated to Postgresql" | ||
| userMigFinished <- register $ counter $ Prometheus.Info "wire_user_remote_convs_migration_finished" "Whether the migration of remote conversation membership data to Postgresql is finished successfully" | ||
| userMigFailed <- register $ counter $ Prometheus.Info "wire_user_remote_convs_migration_failed" "Whether the migration of remote conversation membership data to Postgresql has failed" | ||
| userMigDuration <- register $ vector "outcome" $ histogram (Prometheus.Info "wire_user_remote_convs_migration_duration_seconds_bucket" "Duration of remote conversation membership migration attempts") defaultBuckets |
Contributor
Author
There was a problem hiding this comment.
hm, it seems like it is true.
| count <- register $ counter $ Prometheus.Info "wire_conv_codes_migrated_to_pg" "Number of conversation codes migrated to Postgresql" | ||
| finished <- register $ counter $ Prometheus.Info "wire_conv_codes_migration_finished" "Whether the conversation codes migration to Postgresql is finished successfully" | ||
| failed <- register $ counter $ Prometheus.Info "wire_conv_codes_migration_failed" "Whether the conversation codes migration to Postgresql has failed" | ||
| duration <- register $ vector "outcome" $ histogram (Prometheus.Info "wire_conv_codes_migration_duration_seconds_bucket" "Duration of conversation code migration attempts") defaultBuckets |
| count <- register $ counter $ Prometheus.Info "wire_team_features_migrated_to_pg" "Number of team features migrated to Postgresql" | ||
| finished <- register $ counter $ Prometheus.Info "wire_team_features_migration_finished" "Whether the team features migration to Postgresql is finished successfully" | ||
| failed <- register $ counter $ Prometheus.Info "wire_team_features_migration_failed" "Whether the team features migration to Postgresql has failed" | ||
| duration <- register $ vector "outcome" $ histogram (Prometheus.Info "wire_team_features_migration_duration_seconds_bucket" "Duration of team feature migration attempts") defaultBuckets |
| count <- register $ counter $ Prometheus.Info "wire_domain_registration_migrated_to_pg" "Number of domain registration rows migrated to Postgresql" | ||
| finished <- register $ counter $ Prometheus.Info "wire_domain_registration_migration_finished" "Whether the domain registration migration to Postgresql is finished successfully" | ||
| failed <- register $ counter $ Prometheus.Info "wire_domain_registration_migration_failed" "Whether the domain registration migration to Postgresql has failed" | ||
| duration <- register $ vector "outcome" $ histogram (Prometheus.Info "wire_domain_registration_migration_duration_seconds_bucket" "Duration of domain registration migration attempts") defaultBuckets |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://wearezeta.atlassian.net/browse/WPB-25915
I have tested that it works. However, those test cannot be committed, because they hook into the production migration code to simulate the blocking conversation migration.
Checklist
changelog.d