Skip to content

Commit

Permalink
Add more stats tables (#29730)
Browse files Browse the repository at this point in the history
Add `Tags`, `Branches` and `CommitStatus` to monitor/stats
  • Loading branch information
lunny authored Mar 12, 2024
1 parent 171d3d9 commit e5e2b2f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion models/activities/statistic.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
asymkey_model "code.gitea.io/gitea/models/asymkey"
"code.gitea.io/gitea/models/auth"
"code.gitea.io/gitea/models/db"
git_model "code.gitea.io/gitea/models/git"
issues_model "code.gitea.io/gitea/models/issues"
"code.gitea.io/gitea/models/organization"
access_model "code.gitea.io/gitea/models/perm/access"
Expand All @@ -29,7 +30,8 @@ type Statistic struct {
Mirror, Release, AuthSource, Webhook,
Milestone, Label, HookTask,
Team, UpdateTask, Project,
ProjectBoard, Attachment int64
ProjectBoard, Attachment,
Branches, Tags, CommitStatus int64
IssueByLabel []IssueByLabelCount
IssueByRepository []IssueByRepositoryCount
}
Expand Down Expand Up @@ -58,6 +60,9 @@ func GetStatistic(ctx context.Context) (stats Statistic) {
stats.Counter.Watch, _ = e.Count(new(repo_model.Watch))
stats.Counter.Star, _ = e.Count(new(repo_model.Star))
stats.Counter.Access, _ = e.Count(new(access_model.Access))
stats.Counter.Branches, _ = e.Count(new(git_model.Branch))
stats.Counter.Tags, _ = e.Where("is_draft=?", false).Count(new(repo_model.Release))
stats.Counter.CommitStatus, _ = e.Count(new(git_model.CommitStatus))

type IssueCount struct {
Count int64
Expand Down

0 comments on commit e5e2b2f

Please sign in to comment.