Account ephemeral setup keys metrics (#1128)

This commit is contained in:
Maycon Santos 2023-09-05 23:04:14 +02:00 committed by GitHub
parent c9b2ce08eb
commit 7682fe2e45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -166,6 +166,8 @@ func (w *Worker) generateProperties() properties {
peers int
peersSSHEnabled int
setupKeysUsage int
ephemeralPeersSKs int
ephemeralPeersSKUsage int
activePeersLastDay int
osPeers map[string]int
userPeers int
@ -224,6 +226,10 @@ func (w *Worker) generateProperties() properties {
for _, key := range account.SetupKeys {
setupKeysUsage = setupKeysUsage + key.UsedTimes
if key.Ephemeral {
ephemeralPeersSKs++
ephemeralPeersSKUsage = ephemeralPeersSKUsage + key.UsedTimes
}
}
for _, peer := range account.Peers {
@ -269,6 +275,8 @@ func (w *Worker) generateProperties() properties {
metricsProperties["peers_ssh_enabled"] = peersSSHEnabled
metricsProperties["peers_login_expiration_enabled"] = expirationEnabled
metricsProperties["setup_keys_usage"] = setupKeysUsage
metricsProperties["ephemeral_peers_setup_keys"] = ephemeralPeersSKs
metricsProperties["ephemeral_peers_setup_keys_usage"] = ephemeralPeersSKUsage
metricsProperties["active_peers_last_day"] = activePeersLastDay
metricsProperties["user_peers"] = userPeers
metricsProperties["rules"] = rules