mirror of
https://github.com/idanoo/go-mastodon-stats
synced 2025-07-01 22:02:20 +00:00
Add BookWyrm stats
This commit is contained in:
parent
853e7ea48f
commit
c252860d87
4 changed files with 25 additions and 0 deletions
|
@ -138,6 +138,23 @@ func getUserCounts() ([]metric, error) {
|
|||
}
|
||||
}
|
||||
|
||||
if BOOKWYRM_DB_SCHEMA != "" {
|
||||
userCount, err := runIntQuery(BOOKWYRM_DB_SCHEMA, BOOKWYRM_USER_QUERY)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
} else {
|
||||
m := metric{
|
||||
Service: BOOKWYRM_IDENTIFIER,
|
||||
MetricName: METRICNAME_USERCOUNT,
|
||||
MetricValue: userCount,
|
||||
PreviousDayMetricValue: getLastMetric(BOOKWYRM_IDENTIFIER),
|
||||
PreviousWeekMetricValue: getLastWeekMetric(BOOKWYRM_IDENTIFIER),
|
||||
}
|
||||
log.Printf("%s user count: %d", BOOKWYRM_IDENTIFIER, userCount)
|
||||
metrics = append(metrics, m)
|
||||
}
|
||||
}
|
||||
|
||||
return metrics, nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue