Skip to content

Commit

Permalink
Merge pull request #117 from LucaBernstein/monitoring-version
Browse files Browse the repository at this point in the history
Export version in monitoring
  • Loading branch information
LucaBernstein authored Mar 29, 2022
2 parents e0b237c + ab4fab6 commit db6fc88
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions web/health/monitoring.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package health
import (
"fmt"
"net/http"
"os"

"github.com/LucaBernstein/beancount-bot-tg/bot"
"github.com/LucaBernstein/beancount-bot-tg/helpers"
Expand All @@ -20,6 +21,8 @@ type MonitoringResult struct {
cache_entries_accTo int
cache_entries_accFrom int
cache_entries_txDesc int

version string
}

// TODO: Use package?
Expand Down Expand Up @@ -47,6 +50,10 @@ bc_bot_users_count %d
bc_bot_cache_entries{type="accTo"} %d
bc_bot_cache_entries{type="accFrom"} %d
bc_bot_cache_entries{type="txDesc"} %d
# HELP bc_bot_version_information
# TYPE bc_bot_version_information counter
bc_bot_version_information{version="%s"} 1
`,
m.logs_daily_error,
m.logs_daily_warning,
Expand All @@ -59,6 +66,8 @@ bc_bot_cache_entries{type="txDesc"} %d
m.cache_entries_accTo,
m.cache_entries_accFrom,
m.cache_entries_txDesc,

m.version,
)
}
}
Expand Down Expand Up @@ -94,5 +103,7 @@ func gatherMetrics(bc *bot.BotController) (result *MonitoringResult) {
result.cache_entries_accFrom = accFrom
result.cache_entries_txDesc = txDesc

result.version = os.Getenv("VERSION")

return
}

0 comments on commit db6fc88

Please sign in to comment.