Preserve endpoint identity for duplicate monitor rows#113
Merged
Conversation
Production jetpack_monitor_sites data can contain multiple active monitor URLs for the same blog_id. Treating blog_id as the scheduler identity collapses those rows, which risks skipping checks, merging retry state, and projecting status changes onto the wrong legacy row during rollout. Carry jetpack_monitor_site_id through local checker requests, Veriflier requests and responses, streaming planner state, retry state, HTTP event identity, and legacy status projection updates. blog_id remains the WPCOM/site identity, while endpoint_id records the legacy monitor row for HTTP incidents. Also update the v2-native target table uniqueness to source_site_id, document the identity split, and add regression tests for duplicate active monitor rows plus endpoint-aware status and Veriflier identity handling. Tests: go test ./...
96b2cca to
972006c
Compare
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.
Summary
This PR makes Jetmon v2 treat
jetpack_monitor_sites.jetpack_monitor_site_idas the endpoint identity for HTTP monitor execution when that row id is available. The production table backup showed active duplicateblog_idrows with different monitor URLs; using onlyblog_idrisks collapsing those endpoints in scheduler state, retry state, stale/duplicate result handling, and legacy projection writes.blog_idremains the WPCOM/site identity. The legacy row id is carried as endpoint identity for the monitor path and is written tojetmon_events.endpoint_idfor HTTP incidents.What Changed
MonitorSiteIDthrough local checker requests/results and Veriflier requests/results.eventstore.Identity, with fallback to legacy site-level open events during migration.site_statusprojection byjetpack_monitor_site_idwhen available, with blog-level fallback for older callers.jetmon_check_targetsuniqueness fromblog_idtosource_site_idso future target sync can preserve multiple endpoints per site.Examples
Before this change, two active legacy rows such as:
could collapse into a single scheduler/retry/result entry keyed by
42.After this change, Jetmon v2 checks and tracks both endpoint rows independently:
HTTP incidents remain associated with
blog_id=42for site/WPCOM compatibility while storingendpoint_id=10orendpoint_id=11for the specific monitored URL.Validation
go test ./...