Skip to content

add cache storage metrics #1195

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

Merged
merged 5 commits into from
Sep 22, 2020
Merged

Conversation

astaphobia
Copy link
Contributor

@astaphobia astaphobia commented Sep 22, 2020

Description

Need to add metrics part for cache storage, that will be cool in grafana dashboard.
Showing size in bytes.
Already in is:

  • mempools
  • batch_receipts
  • scramble_nodes
  • backup_mempools
  • node_shards
  • node_address_infos

@@ -270,6 +271,12 @@ func SetMonitoringActive(isActive bool) {
}, []string{"status"})
prometheus.MustRegister(dbStatGaugeVector)

// Cache Storage
cacheStorageCounter = prometheus.NewGaugeVec(prometheus.GaugeOpts{
Name: "cache_storage_counter",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO it's better to prefix the name with zoobc_ so that we can easily find the metrics in grafana

cacheStorageCounter = prometheus.NewGaugeVec(prometheus.GaugeOpts{
Name: "cache_storage_counter",
Help: "Cache Storage counter",
}, []string{"mempools", "batch_receipts", "scramble_nodes", "backup_mempools", "node_shards"})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO this is enough with 1 bucket []string{"storage_type"}

@@ -270,6 +271,12 @@ func SetMonitoringActive(isActive bool) {
}, []string{"status"})
prometheus.MustRegister(dbStatGaugeVector)

// Cache Storage
cacheStorageCounter = prometheus.NewGaugeVec(prometheus.GaugeOpts{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO better to name it cacheStorageGaugeVector to be able to understand it easily at a glance. what do you think?

Comment on lines 569 to 580
switch cacheType {
case TypeMempoolCacheStorage:
cacheStorageCounter.WithLabelValues(string(cacheType)).Set(size)
case TypeBatchReceiptCacheStorage:
cacheStorageCounter.WithLabelValues(string(cacheType)).Set(size)
case TypeScrambleNodeCacheStorage:
cacheStorageCounter.WithLabelValues(string(cacheType)).Set(size)
case TypeMempoolBackupCacheStorage:
cacheStorageCounter.WithLabelValues(string(cacheType)).Set(size)
case TypeNodeShardCacheStorage:
cacheStorageCounter.WithLabelValues(string(cacheType)).Set(size)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't need this switch case. doing it cacheStorageCounter.WithLabelValues(string(cacheType)).Set(size) I think is enough

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, sorry. will update now

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

already updated @capt4ce

@capt4ce capt4ce merged commit 46ce337 into experimental Sep 22, 2020
@capt4ce capt4ce deleted the feature/add-cache-storage-metrics branch September 22, 2020 07:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants