: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
mod event;
use axum::routing::{get, post};
use axum::{extract::State, response::IntoResponse, Router};
pub use event::*;
use health::HealthStatus;
use reqwest::StatusCode;
use std::future::ready;
use std::sync::Arc;
use crate::app_context::AppContext;
async fn index() -> &'static str {
"error tracking service"
}
async fn liveness(State(ctx): State<Arc<AppContext>>) -> HealthStatus {
ready(ctx.health_registry.get_status()).await
}
async fn not_found() -> impl IntoResponse {
(StatusCode::NOT_FOUND, "Not Found")
}
pub fn get_router(context: Arc<AppContext>) -> Router {
Router::new()
.route("/", get(index))
.route("/process", post(process_events))
.route("/_readiness", get(index))
.route("/_liveness", get(liveness))
.fallback(not_found)
.with_state(context.clone())
}