GoodAnalytics.Connectors.Planner (GoodAnalytics v0.1.1)

Copy Markdown View Source

Evaluates enabled connectors for an event and creates dispatch records.

For each connector-eligible event, the planner:

  1. Checks the global kill switch
  2. Iterates all registered connectors
  3. Checks per-workspace enablement
  4. Checks connector support for the event type
  5. Checks required signals
  6. Invokes the global dispatch policy callback
  7. Creates dispatch records for all eligible connectors
  8. Emits telemetry for skipped connectors with skip reasons

Custom-event mapping snapshots

For custom events, the enabled mapping is resolved at dispatch-planning time (immediately after the event commits) and snapshotted into the dispatch's source_context under the reserved "mapping" key via EventMapping.to_snapshot/1. That snapshot — not the live mapping — is what delivery and replay read, so a dispatch's outbound conversion is deterministic once the dispatch row exists, even if the mapping is later edited or deleted.

The snapshot is authoritative only from dispatch creation onward: the mapping in effect when the event was recorded is not captured on the event, so a mapping change in the (typically sub-second) window between event commit and planning is reflected in the dispatch. Reconciliation likewise gates on the mappings current at reconciliation time within its lookback window.

Summary

Functions

Plans and creates dispatch records for a committed event.

Functions

plan(event, signals, source_context, opts \\ [])

Plans and creates dispatch records for a committed event.

Returns {:ok, dispatches} with the list of created dispatch records, or {:skip, :connectors_disabled} if the global kill switch is off.

Parameters

  • event — the committed event struct
  • signals — normalized connector signals map
  • source_context — the event-time source context for payload rebuilds
  • opts — optional keyword list:
    • :consent_status — consent status atom (default: :consented)