Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions crates/pulse-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ rand = "0.10"
base64 = "0.22"
hex = "0.4"
url = "2"
# Path cleaning rules (RE2-style, same family as PostHog/ClickHouse)
regex = "1"

# User-Agent parsing
woothee = "0.13"
Expand Down
8 changes: 8 additions & 0 deletions crates/pulse-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,14 @@ async fn main() -> anyhow::Result<()> {
"/api/v1/insights/lifecycle/actors",
axum::routing::post(routes::insights::lifecycle_actors),
)
.route(
"/api/v1/insights/paths",
axum::routing::post(routes::insights::paths),
)
.route(
"/api/v1/insights/paths/actors",
axum::routing::post(routes::insights::paths_actors),
)
// Funnels
.route(
"/api/v1/funnels",
Expand Down
24 changes: 24 additions & 0 deletions crates/pulse-server/src/routes/insights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use crate::error::AppResult;
use crate::middleware::auth::AuthenticatedProject;
use crate::services;
use crate::services::insights::funnels::{FunnelActorsQuery, FunnelsQuery};
use crate::services::insights::paths::{PathsActorsQuery, PathsQuery};
use crate::services::insights::retention::{RetentionActorsQuery, RetentionQuery};
use crate::services::insights::trends::{TrendsActorsQuery, TrendsQuery};
use crate::state::SharedState;
Expand Down Expand Up @@ -207,3 +208,26 @@ pub async fn lifecycle_actors(
.await?;
Ok(Json(result))
}

// POST /api/v1/insights/paths
pub async fn paths(
Extension(state): Extension<SharedState>,
auth: AuthenticatedProject,
Json(query): Json<PathsQuery>,
) -> AppResult<impl IntoResponse> {
authorize(&state, &auth, query.reads_person_properties()).await?;
let result = services::insights::paths::run_paths(&state.db, auth.project_id, &query).await?;
Ok(Json(result))
}

// POST /api/v1/insights/paths/actors
pub async fn paths_actors(
Extension(state): Extension<SharedState>,
auth: AuthenticatedProject,
Json(query): Json<PathsActorsQuery>,
) -> AppResult<impl IntoResponse> {
authorize(&state, &auth, true).await?;
let result =
services::insights::paths::run_paths_actors(&state.db, auth.project_id, &query).await?;
Ok(Json(result))
}
1 change: 1 addition & 0 deletions crates/pulse-server/src/services/insights/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
pub mod filters;
pub mod formula;
pub mod funnels;
pub mod paths;
pub mod retention;
pub mod stickiness;
pub mod trends;
Expand Down
Loading
Loading