Class: Audiences::Integrations::ObserverBase

Inherits:
AetherObservatory::ObserverBase
  • Object
show all
Defined in:
lib/audiences/integrations/observer_base.rb

Instance Method Summary collapse

Instance Method Details

#log_sync_operation(action:, resource_type:, scim_id:, correlation_id: event_payload.correlation_id) { ... } ⇒ Object

Logs the start and completion of a sync operation Automatically logs “start” before yielding and “complete” in ensure block

Parameters:

  • action (String)

    The action being performed (e.g., “create”, “update”, “delete”)

  • resource_type (String)

    The type of resource (e.g., “Users”, “Groups”)

  • scim_id (String)

    The SCIM ID of the resource

  • correlation_id (String) (defaults to: event_payload.correlation_id)

    The correlation ID from the event (defaults to event_payload.correlation_id)

Yields:

  • The block containing the sync operation



14
15
16
17
18
19
20
21
# File 'lib/audiences/integrations/observer_base.rb', line 14

def log_sync_operation(action:, resource_type:, scim_id:, correlation_id: event_payload.correlation_id)
  log_data = build_log_data(action: action, resource_type: resource_type, scim_id: scim_id,
                            correlation_id: correlation_id)
  Audiences.logger.info({ **log_data, stage: "start" }.to_json)
  yield
ensure
  Audiences.logger.info({ **log_data, stage: "complete" }.to_json)
end