mirror of
https://github.com/fosrl/pangolin.git
synced 2026-03-08 03:36:37 +00:00
simplify telemetry collection
This commit is contained in:
@@ -200,10 +200,7 @@ class TelemetryClient {
|
|||||||
event: "supporter_status",
|
event: "supporter_status",
|
||||||
properties: {
|
properties: {
|
||||||
valid: stats.supporterStatus.valid,
|
valid: stats.supporterStatus.valid,
|
||||||
tier: stats.supporterStatus.tier,
|
tier: stats.supporterStatus.tier
|
||||||
github_username: stats.supporterStatus.githubUsername
|
|
||||||
? this.anon(stats.supporterStatus.githubUsername)
|
|
||||||
: "None"
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -217,21 +214,6 @@ class TelemetryClient {
|
|||||||
install_timestamp: hostMeta.createdAt
|
install_timestamp: hostMeta.createdAt
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
for (const email of stats.adminUsers) {
|
|
||||||
// There should only be on admin user, but just in case
|
|
||||||
if (email) {
|
|
||||||
this.client.capture({
|
|
||||||
distinctId: this.anon(email),
|
|
||||||
event: "admin_user",
|
|
||||||
properties: {
|
|
||||||
host_id: hostMeta.hostMetaId,
|
|
||||||
app_version: stats.appVersion,
|
|
||||||
hashed_email: this.anon(email)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async collectAndSendAnalytics() {
|
private async collectAndSendAnalytics() {
|
||||||
@@ -262,19 +244,38 @@ class TelemetryClient {
|
|||||||
num_clients: stats.numClients,
|
num_clients: stats.numClients,
|
||||||
num_identity_providers: stats.numIdentityProviders,
|
num_identity_providers: stats.numIdentityProviders,
|
||||||
num_sites_online: stats.numSitesOnline,
|
num_sites_online: stats.numSitesOnline,
|
||||||
resources: stats.resources.map((r) => ({
|
num_resources_sso_enabled: stats.resources.filter(
|
||||||
name: this.anon(r.name),
|
(r) => r.sso
|
||||||
sso_enabled: r.sso,
|
).length,
|
||||||
protocol: r.protocol,
|
num_resources_non_http: stats.resources.filter(
|
||||||
http_enabled: r.http
|
(r) => !r.http
|
||||||
})),
|
).length,
|
||||||
sites: stats.sites.map((s) => ({
|
num_newt_sites: stats.sites.filter((s) => s.type === "newt")
|
||||||
site_name: this.anon(s.siteName),
|
.length,
|
||||||
megabytes_in: s.megabytesIn,
|
num_local_sites: stats.sites.filter(
|
||||||
megabytes_out: s.megabytesOut,
|
(s) => s.type === "local"
|
||||||
type: s.type,
|
).length,
|
||||||
online: s.online
|
num_wg_sites: stats.sites.filter(
|
||||||
})),
|
(s) => s.type === "wireguard"
|
||||||
|
).length,
|
||||||
|
avg_megabytes_in:
|
||||||
|
stats.sites.length > 0
|
||||||
|
? Math.round(
|
||||||
|
stats.sites.reduce(
|
||||||
|
(sum, s) => sum + (s.megabytesIn ?? 0),
|
||||||
|
0
|
||||||
|
) / stats.sites.length
|
||||||
|
)
|
||||||
|
: 0,
|
||||||
|
avg_megabytes_out:
|
||||||
|
stats.sites.length > 0
|
||||||
|
? Math.round(
|
||||||
|
stats.sites.reduce(
|
||||||
|
(sum, s) => sum + (s.megabytesOut ?? 0),
|
||||||
|
0
|
||||||
|
) / stats.sites.length
|
||||||
|
)
|
||||||
|
: 0,
|
||||||
num_api_keys: stats.numApiKeys,
|
num_api_keys: stats.numApiKeys,
|
||||||
num_custom_roles: stats.numCustomRoles
|
num_custom_roles: stats.numCustomRoles
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user