Track new analytics metrics in backend (#5895)

* Allow filtering by project IDs in analytics route

* Download meta info in header

* add recursion limit

* Track playtime country

* fix clickhouse migrations
This commit is contained in:
aecsocket
2026-04-24 16:43:25 +01:00
committed by GitHub
parent 42cdcc7df9
commit e3d6a498d0
7 changed files with 89 additions and 11 deletions

View File

@@ -23,6 +23,23 @@ pub struct Download {
pub country: String,
pub user_agent: String,
pub headers: Vec<(String, String)>,
// added retroactively - may be missing
pub reason: Option<DownloadReason>,
pub game_version: Option<String>,
pub loader: Option<String>,
}
/// Why a project was downloaded.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum DownloadReason {
/// Project was downloaded directly by the user.
Standalone,
/// Project was downloaded as a dependency, possibly transitive, of another
/// project.
Dependency,
/// Project was downloaded as part of a modpack.
Modpack,
}
#[derive(Debug, Row, Serialize, Deserialize, Clone, Eq, PartialEq, Hash)]
@@ -77,6 +94,9 @@ pub struct Playtime {
pub game_version: String,
/// Parent modpack this playtime was recorded in
pub parent: u64,
// added retroactively - may be missing
pub country: Option<String>,
}
#[derive(Row, Serialize, Deserialize, Clone, Debug, Eq, PartialEq, Hash)]