Skip to content
GitLab
Explorer
Connexion
S'inscrire
Navigation principale
Rechercher ou aller à…
Projet
P
parlote-facil
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Extraits de code
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Déploiement
Releases
Registre de paquets
Registre de conteneur
Registre de modèles
Opération
Environnements
Modules Terraform
Surveillance
Incidents
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse CI/CD
Données d'analyse du dépôt
Expériences du modèle
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
facil
parlote-facil
Validations
1d228fa8
Valider
1d228fa8
rédigé
14 years ago
par
zhitomirskiyi
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
stats rake file now works with mysql; production
parent
a5b4dd26
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
1
Masquer les modifications d'espaces
En ligne
Côte à côte
Affichage de
1 fichier modifié
lib/tasks/statistics.rake
+62
-45
62 ajouts, 45 suppressions
lib/tasks/statistics.rake
avec
62 ajouts
et
45 suppressions
lib/tasks/statistics.rake
+
62
−
45
Voir le fichier @
1d228fa8
namespace
:statistics
do
namespace
:statistics
do
require
'config/environment'
desc
'on users: total, active'
desc
'on users: total, active'
task
:users
=>
:environment
do
puts
"Users: %i and %i incomplete"
%
[
User
.
where
(
:getting_started
=>
false
).
count
,
User
.
where
(
:getting_started
=>
true
,
:sign_in_count
.
gt
=>
0
).
count
]
puts
"Invitations sent: %i"
%
Invitation
.
count
puts
"Contacts: %i and %i pending"
%
[
p
=
Contact
.
where
(
:pending
=>
false
).
count
,
Contact
.
count
-
p
]
puts
"Aspects: %i"
%
Aspect
.
count
puts
"Users signed in in last 24h: %i"
%
User
.
where
(
:current_sign_in_at
.
gt
=>
Time
.
now
-
1
.
day
).
count
puts
"Users signed in in last 7d: %i"
%
User
.
where
(
:current_sign_in_at
.
gt
=>
Time
.
now
-
7
.
days
).
count
end
task
:users_splunk
=>
:environment
do
namespace
:users
do
puts
"event=statistic, type=users, count=
#{
User
.
count
}
, "
+
users
=
User
.
where
(
:getting_started
=>
false
).
count
"incomplete=
#{
User
.
where
(
:getting_started
=>
true
,
:sign_in_count
.
gt
=>
0
).
count
}
, "
+
incomplete
=
User
.
where
(
"getting_started = TRUE AND sign_in_count >= 0"
).
count
"last_1d=
#{
User
.
where
(
:current_sign_in_at
.
gt
=>
Time
.
now
-
1
.
days
).
count
}
, "
+
invitations
=
Invitation
.
count
"last_7d=
#{
User
.
where
(
:current_sign_in_at
.
gt
=>
Time
.
now
-
7
.
days
).
count
}
, "
+
contacts_active
=
Contact
.
where
(
:pending
=>
false
).
count
"notification_off=
#{
User
.
where
(
:disable_mail
=>
true
).
count
}
, "
+
contacts_pending
=
Contact
.
count
-
contacts_active
"notification_off_%=
#{
User
.
where
(
:disable_mail
=>
true
).
count
.
to_f
/
User
.
count
}
, "
+
aspects
=
Aspect
.
count
"no_invites=
#{
User
.
where
(
:invites
=>
0
).
count
}
, "
+
last_24_hrs
=
User
.
where
(
"current_sign_in_at > '
#{
(
Time
.
now
-
1
.
day
).
to_date
}
'"
).
count
"last_7d_%=
#{
User
.
where
(
:current_sign_in_at
.
gt
=>
Time
.
now
-
7
.
days
).
count
.
to_f
/
User
.
count
}
, "
+
last_7_d
=
User
.
where
(
"current_sign_in_at > '
#{
(
Time
.
now
-
7
.
days
).
to_date
}
'"
).
count
"last_7d_and_notifications_off_%=
#{
User
.
where
(
:current_sign_in_at
.
gt
=>
Time
.
now
-
7
.
days
,
:disable_mail
=>
true
).
count
.
to_f
/
User
.
where
(
:disable_mail
=>
true
).
count
}
, "
+
"last_7d_and_no_invites_%=
#{
User
.
where
(
:current_sign_in_at
.
gt
=>
Time
.
now
-
7
.
days
,
:invites
=>
0
).
count
.
to_f
/
User
.
where
(
:invites
=>
0
).
count
}
"
notification_off
=
User
.
where
(
:disable_mail
=>
true
).
count
notification_off_per
=
notification_off
.
to_f
/
users
no_invites
=
User
.
where
(
:invites
=>
0
).
count
puts
"event=statistic, type=invitations, count=
#{
Invitation
.
count
}
"
task
:human
=>
:environment
do
puts
"event=statistic, type=contacts, active_count=
#{
Contact
.
where
(
:pending
=>
false
).
count
}
"
puts
"Users: %i and %i incomplete"
%
[
users
,
incomplete
]
puts
"event=statistic, type=contacts, pending_count=
#{
Contact
.
where
(
:pending
=>
true
).
count
}
"
puts
"Invitations sent: %i"
%
invitations
puts
"Contacts: %i and %i pending"
%
[
contacts_active
,
contacts_pending
]
puts
"Aspects: %i"
%
aspects
puts
"Users signed in in last 24h: %i"
%
last_24_hrs
puts
"Users signed in in last 7d: %i"
%
last_7_d
end
puts
"event=statistic, type=aspect, count=
#{
Aspect
.
count
}
"
task
:splunk
=>
:environment
do
puts
"event=statistic, type=users, count=
#{
users
}
, "
+
"incomplete=
#{
incomplete
}
, "
+
"last_1d=
#{
last_24_hrs
}
, "
+
"last_7d=
#{
last_7_d
}
, "
+
"notification_off=
#{
notification_off
}
, "
+
"notification_off_%=
#{
notification_off_per
}
, "
+
"no_invites=
#{
no_invites
}
"
puts
"event=statistic, type=invitations, count=
#{
invitations
}
"
puts
"event=statistic, type=contacts, active_count=
#{
contacts_active
}
"
puts
"event=statistic, type=contacts, pending_count=
#{
contacts_pending
}
"
puts
"event=statistic, type=aspect, count=
#{
aspects
}
"
end
end
end
desc
'on content: posts, photos, status messages, comments'
desc
'on content: posts, photos, status messages, comments'
task
:content
=>
:environment
do
namespace
:content
do
puts
"Services: %i Facebook, %i Twitter"
%
[
Services
::
Facebook
.
count
,
Services
::
Twitter
.
count
]
task
:human
=>
:environment
do
puts
"Posts: %i and %i are public"
%
[
Post
.
count
,
Post
.
where
(
:public
=>
true
).
count
]
puts
"Services: %i Facebook, %i Twitter"
%
[
Services
::
Facebook
.
count
,
Services
::
Twitter
.
count
]
puts
"Status messages: %i"
%
[
StatusMessage
.
count
,
StatusMessage
.
where
(
:public
=>
true
).
count
]
puts
"Posts: %i and %i are public"
%
[
Post
.
count
,
Post
.
where
(
:public
=>
true
).
count
]
puts
"Comments: %i"
%
Comment
.
count
puts
"Status messages: %i"
%
[
StatusMessage
.
count
,
StatusMessage
.
where
(
:public
=>
true
).
count
]
puts
"Photos: %i"
%
Photo
.
count
puts
"Comments: %i"
%
Comment
.
count
end
puts
"Photos: %i"
%
Photo
.
count
end
task
:content_splunk
=>
:environment
do
puts
"event=statistic, type=posts, count=
#{
Post
.
count
}
, public_count=
#{
Post
.
where
(
:public
=>
true
).
count
}
, public_% =
#{
Post
.
where
(
:public
=>
true
).
count
.
to_f
/
Post
.
count
}
, "
+
task
:splunk
=>
:environment
do
"last_day =
#{
Post
.
where
(
:created_at
.
gt
=>
Time
.
now
-
1
.
days
).
count
}
, last_day_public_count=
#{
Post
.
where
(
:created_at
.
gt
=>
Time
.
now
-
1
.
days
,
:public
=>
true
).
count
}
, "
+
post_count
=
Post
.
count
"last_day_public_% =
#{
Post
.
where
(
:created_at
.
gt
=>
Time
.
now
-
1
.
days
,
:public
=>
true
).
count
.
to_f
/
Post
.
where
(
:created_at
.
gt
=>
Time
.
now
-
1
.
days
).
count
}
"
public_count
=
Post
.
where
(
:public
=>
true
).
count
end
public_per
=
public_count
.
to_f
/
post_count
posts_last_day
=
Post
.
where
(
"created_at > '
#{
(
Time
.
now
-
1
.
days
).
to_date
}
'"
).
count
posts_last_day_public
=
Post
.
where
(
"created_at > '
#{
(
Time
.
now
-
1
.
days
).
to_date
}
' AND public = true"
).
count
posts_last_day_public_per
=
posts_last_day_public
.
to_f
/
posts_last_day
task
:genders
=>
:environment
do
puts
"event=statistic, type=posts, count=
#{
post_count
}
, "
+
genders
=
Person
.
collection
.
group
([
'profile.gender'
],
{},
{
:count
=>
0
},
'function(o,p) { p.count++; }'
,
true
)
"public_count=
#{
public_count
}
, "
+
genders
.
sort!
{
|
a
,
b
|
a
[
'profile.gender'
].
to_s
<=>
b
[
'profile.gender'
].
to_s
}
"public_%=
#{
public_per
}
, "
+
genders
.
each
do
|
gender
|
"last_day=
#{
posts_last_day
}
, "
+
puts
"%s: %i"
%
[
gender
[
'profile.gender'
]
||
'none given'
,
gender
[
'count'
]]
"last_day_public_count=
#{
posts_last_day_public
}
, "
+
"last_day_public_%=
#{
posts_last_day_public_per
}
"
end
end
end
end
end
end
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter