Skip to content

Preserve endpoint identity for duplicate monitor rows#113

Merged
chrisbliss18 merged 1 commit into
v2from
feature/monitor-endpoint-identity
May 14, 2026
Merged

Preserve endpoint identity for duplicate monitor rows#113
chrisbliss18 merged 1 commit into
v2from
feature/monitor-endpoint-identity

Conversation

@chrisbliss18
Copy link
Copy Markdown
Contributor

@chrisbliss18 chrisbliss18 commented May 14, 2026

Summary

This PR makes Jetmon v2 treat jetpack_monitor_sites.jetpack_monitor_site_id as the endpoint identity for HTTP monitor execution when that row id is available. The production table backup showed active duplicate blog_id rows with different monitor URLs; using only blog_id risks collapsing those endpoints in scheduler state, retry state, stale/duplicate result handling, and legacy projection writes.

blog_id remains the WPCOM/site identity. The legacy row id is carried as endpoint identity for the monitor path and is written to jetmon_events.endpoint_id for HTTP incidents.

What Changed

  • Carries MonitorSiteID through local checker requests/results and Veriflier requests/results.
  • Keys round scheduler maps, streaming planner targets, due-wheel entries, retry state, side-effect caches, and result correlation by monitor row id when available.
  • Opens and finds HTTP events with endpoint-aware eventstore.Identity, with fallback to legacy site-level open events during migration.
  • Updates legacy site_status projection by jetpack_monitor_site_id when available, with blog-level fallback for older callers.
  • Updates jetmon_check_targets uniqueness from blog_id to source_site_id so future target sync can preserve multiple endpoints per site.
  • Documents the site-vs-endpoint identity split in the data model, streaming engine ADR, and roadmap.

Examples

Before this change, two active legacy rows such as:

jetpack_monitor_site_id=10 blog_id=42 monitor_url=https://example.com/
jetpack_monitor_site_id=11 blog_id=42 monitor_url=https://example.com/path

could collapse into a single scheduler/retry/result entry keyed by 42.

After this change, Jetmon v2 checks and tracks both endpoint rows independently:

target_id=10 blog_id=42 endpoint=https://example.com/
target_id=11 blog_id=42 endpoint=https://example.com/path

HTTP incidents remain associated with blog_id=42 for site/WPCOM compatibility while storing endpoint_id=10 or endpoint_id=11 for the specific monitored URL.

Validation

  • go test ./...

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 ./...
@chrisbliss18 chrisbliss18 force-pushed the feature/monitor-endpoint-identity branch from 96b2cca to 972006c Compare May 14, 2026 13:49
@chrisbliss18 chrisbliss18 merged commit ba09fe7 into v2 May 14, 2026
2 checks passed
@chrisbliss18 chrisbliss18 deleted the feature/monitor-endpoint-identity branch May 14, 2026 13:54
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.

1 participant