GoodAnalytics.Api.RequestLoggerPlug (GoodAnalytics v0.1.1)

Copy Markdown View Source

Plug that records API requests as api_request events.

Add to a host app's API pipeline to automatically track API activity. Uses register_before_send to invoke callbacks synchronously (while the conn is still available), then spawns a fire-and-forget task for identity resolution and event recording using only scalar data.

Required options

  • :paths - list of path prefixes to match (e.g., ["/api"])
  • :workspace_id - (conn -> uuid) or {Module, :function} callback
  • :identity - (conn -> map | :skip) or {Module, :function} callback

Optional options

  • :path - (conn -> binary) callback to redact the recorded path
  • :properties - (conn -> map) callback to merge extra properties
  • :task_supervisor - supervisor name (default: GoodAnalytics.TaskSupervisor)