Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

601 B
Raw Blame
"""The logs alerts whose destinations the cutover bucket report reads."""

from __future__ import annotations

from collections.abc import Iterator

from products.logs.backend.models import LogsAlertConfiguration


def enabled_logs_alerts(*, team_id: int | None = None) -> Iterator[tuple[int, str]]:
    alerts = LogsAlertConfiguration.objects.filter(enabled=True).order_by("team_id", "created_at")
    if team_id is not None:
        alerts = alerts.filter(team_id=team_id)
    for alert_team_id, alert_id in alerts.values_list("team_id", "id").iterator():
        yield alert_team_id, str(alert_id)