-
Notifications
You must be signed in to change notification settings - Fork 501
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
services/horizon: Export ledger stats in /metrics, add claimable_balance to change stats #3148
Conversation
…nce to change stats
@@ -82,6 +95,10 @@ func (stats *StatsChangeProcessorResults) Map() map[string]interface{} { | |||
"stats_accounts_updated": stats.AccountsUpdated, | |||
"stats_accounts_removed": stats.AccountsRemoved, | |||
|
|||
"stats_claimable_balances_created": stats.ClaimableBalancesCreated, | |||
"stats_claimable_balances_updated": stats.ClaimableBalancesUpdated, | |||
"stats_claimable_balances_removed": stats.ClaimableBalancesRemoved, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to extend the CB integration tests to check these new fields, or do you think unit tests are sufficient?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure we have any tests for this so far. If we want to add some integration tests, I'd vote for adding this in another PR.
|
||
// Update stats metrics | ||
changeStatsMap := changeStats.Map() | ||
for stat, value := range changeStatsMap { | ||
stat = strings.Replace(stat, "stats_", "change_", 1) | ||
s.Metrics().LedgerStatsCounter. | ||
With(prometheus.Labels{"type": stat}).Add(float64(value.(int64))) | ||
} | ||
|
||
ledgerTransactionStatsMap := ledgerTransactionStats.Map() | ||
for stat, value := range ledgerTransactionStatsMap { | ||
stat = strings.Replace(stat, "stats_", "ledger_", 1) | ||
s.Metrics().LedgerStatsCounter. | ||
With(prometheus.Labels{"type": stat}).Add(float64(value.(int64))) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would it be worth to factor out the metrics-updating code? (the method is already pretty large)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's better, yeah.
PR Checklist
PR Structure
otherwise).
services/friendbot
, orall
ordoc
if the changes are broad or impact manypackages.
Thoroughness
.md
files, etc... affected by this change). Take a look in the
docs
folder for a given service,like this one.
Release planning
needed with deprecations, added features, breaking changes, and DB schema changes.
semver, or if it's mainly a patch change. The PR is targeted at the next
release branch if it's not a patch change.
What
Export ledger stats (number of ops and changes) in
/metrics
. Add claimable balances to changes stats.Close #3133.
Why
To be able to correlate slow ledger with network activitity.