mirror of
https://github.com/fosrl/pangolin.git
synced 2026-01-28 22:00:51 +00:00
simplify telemetry collection
This commit is contained in:
@@ -200,10 +200,7 @@ class TelemetryClient {
|
||||
event: "supporter_status",
|
||||
properties: {
|
||||
valid: stats.supporterStatus.valid,
|
||||
tier: stats.supporterStatus.tier,
|
||||
github_username: stats.supporterStatus.githubUsername
|
||||
? this.anon(stats.supporterStatus.githubUsername)
|
||||
: "None"
|
||||
tier: stats.supporterStatus.tier
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -217,21 +214,6 @@ class TelemetryClient {
|
||||
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() {
|
||||
@@ -262,19 +244,38 @@ class TelemetryClient {
|
||||
num_clients: stats.numClients,
|
||||
num_identity_providers: stats.numIdentityProviders,
|
||||
num_sites_online: stats.numSitesOnline,
|
||||
resources: stats.resources.map((r) => ({
|
||||
name: this.anon(r.name),
|
||||
sso_enabled: r.sso,
|
||||
protocol: r.protocol,
|
||||
http_enabled: r.http
|
||||
})),
|
||||
sites: stats.sites.map((s) => ({
|
||||
site_name: this.anon(s.siteName),
|
||||
megabytes_in: s.megabytesIn,
|
||||
megabytes_out: s.megabytesOut,
|
||||
type: s.type,
|
||||
online: s.online
|
||||
})),
|
||||
num_resources_sso_enabled: stats.resources.filter(
|
||||
(r) => r.sso
|
||||
).length,
|
||||
num_resources_non_http: stats.resources.filter(
|
||||
(r) => !r.http
|
||||
).length,
|
||||
num_newt_sites: stats.sites.filter((s) => s.type === "newt")
|
||||
.length,
|
||||
num_local_sites: stats.sites.filter(
|
||||
(s) => s.type === "local"
|
||||
).length,
|
||||
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_custom_roles: stats.numCustomRoles
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user