PaperTiger.TelemetryHandler (PaperTiger v0.7.0)
View SourceHandles telemetry events and creates Stripe events + delivers webhooks.
This module bridges the gap between resource operations and webhook delivery. When resources emit telemetry events (e.g., customer created), this handler:
- Creates a Stripe Event object
- Stores it in the Events store
- Delivers webhooks to registered endpoints
Event Naming Convention
Telemetry events follow the pattern: [:paper_tiger, :resource_type, :action]
Which maps to Stripe event types: resource_type.action (e.g., "customer.created")
For nested types like subscriptions: [:paper_tiger, :subscription, :created] -> "customer.subscription.created"
Summary
Functions
Attaches all telemetry handlers for PaperTiger events.
Detaches all telemetry handlers.
Handles a telemetry event by creating a Stripe event and delivering webhooks.
Functions
@spec attach() :: :ok
Attaches all telemetry handlers for PaperTiger events.
Call this during application startup.
@spec detach() :: :ok | {:error, :not_found}
Detaches all telemetry handlers.
Useful for testing or cleanup.
Handles a telemetry event by creating a Stripe event and delivering webhooks.