mirror of
https://github.com/idanoo/go-mastodon-stats
synced 2025-07-01 22:02:20 +00:00
Test adding MySQL
This commit is contained in:
parent
44a6a2b634
commit
ee2ab2b7a2
9 changed files with 111 additions and 11 deletions
|
@ -172,6 +172,23 @@ func getUserCounts() ([]metric, error) {
|
|||
}
|
||||
}
|
||||
|
||||
if WRIETAS_DB_SCHEMA != "" {
|
||||
userCount, err := runMySqlIntQuery(WRIETAS_DB_SCHEMA, WRITEAS_USER_QUERY)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
} else {
|
||||
m := metric{
|
||||
Service: WRITEAS_IDENTIFIER,
|
||||
MetricName: METRICNAME_USERCOUNT,
|
||||
MetricValue: userCount,
|
||||
PreviousDayMetricValue: getLastMetric(WRITEAS_IDENTIFIER),
|
||||
PreviousWeekMetricValue: getLastWeekMetric(WRITEAS_IDENTIFIER),
|
||||
}
|
||||
log.Printf("%s user count: %d", WRITEAS_IDENTIFIER, userCount)
|
||||
metrics = append(metrics, m)
|
||||
}
|
||||
}
|
||||
|
||||
return metrics, nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue