: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
from posthog.api.routing import RouterRegistry
from products.metrics.backend.presentation.api import MetricsViewSet
from products.metrics.backend.presentation.dashboard_import_api import MetricsDashboardImportViewSet
from products.metrics.backend.presentation.prometheus_api import PrometheusQueryViewSet
from products.metrics.backend.presentation.suggested_dashboards_api import (
MetricsDashboardTemplateViewSet,
MetricsSuggestedDashboardViewSet,
)
def register_routes(routers: RouterRegistry) -> None:
routers.projects.register(r"metrics", MetricsViewSet, "project_metrics", ["team_id"])
routers.projects.register(r"metrics/prometheus", PrometheusQueryViewSet, "project_metrics_prometheus", ["team_id"])
routers.projects.register(
r"metrics/dashboard_imports",
MetricsDashboardImportViewSet,
"project_metrics_dashboard_imports",
["team_id"],
)
routers.projects.register(
r"metrics/suggested_dashboards",
MetricsSuggestedDashboardViewSet,
"project_metrics_suggested_dashboards",
["team_id"],
)
routers.projects.register(
r"metrics/dashboard_templates",
MetricsDashboardTemplateViewSet,
"project_metrics_dashboard_templates",
["team_id"],
)