♻️(backend) refactor analytics backend from Protocol to abstract class

Switch the analytics backend interface from a typing Protocol to an
abstract base class, so the contract that backends must implement
is explicit and enforced at instantiation time.
This commit is contained in:
lebaudantoine
2026-07-07 11:20:12 +02:00
committed by aleb_the_flash
parent 3c0ba03976
commit b00c4e5d6d
3 changed files with 10 additions and 9 deletions
+2 -1
View File
@@ -6,12 +6,13 @@ from typing import Any
from posthog import Posthog
from ..models import User
from . import AnalyticsBackend
from .events import AnalyticsEvent
logger = logging.getLogger(__name__)
class PostHogAnalytics:
class PostHogAnalytics(AnalyticsBackend):
"""Send events to PostHog, keyed on the user's primary key (UUID)."""
def __init__(