This repository has been archived by the owner on Apr 2, 2024. It is now read-only.
generated from mrz1836/go-template
-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(BUX-467): adjustments after with-grafana tests
- Loading branch information
1 parent
263fc95
commit 36a09b8
Showing
8 changed files
with
52 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,26 @@ | ||
package metrics | ||
|
||
import "github.com/prometheus/client_golang/prometheus" | ||
// SetXPubCount adds a value to the stats gauge with the label "xpub" | ||
func (m *Metrics) SetXPubCount(value int64) { | ||
m.stats.WithLabelValues("xpub").Set(float64(value)) | ||
} | ||
|
||
// SetUtxoCount adds a value to the stats gauge with the label "utxo" | ||
func (m *Metrics) SetUtxoCount(value int64) { | ||
m.stats.WithLabelValues("utxo").Set(float64(value)) | ||
} | ||
|
||
// SetPaymailCount adds a value to the stats gauge with the label "paymail" | ||
func (m *Metrics) SetPaymailCount(value int64) { | ||
m.stats.WithLabelValues("paymail").Set(float64(value)) | ||
} | ||
|
||
// Stats is a struct that contains all the gauges that are used to track the calculated stats of the application | ||
type Stats struct { | ||
XPub prometheus.Gauge | ||
Utxo prometheus.Gauge | ||
Paymail prometheus.Gauge | ||
Destination prometheus.Gauge | ||
AccessKey prometheus.Gauge | ||
// SetDestinationCount adds a value to the stats gauge with the label "destination" | ||
func (m *Metrics) SetDestinationCount(value int64) { | ||
m.stats.WithLabelValues("destination").Set(float64(value)) | ||
} | ||
|
||
func registerStats(collector Collector) Stats { | ||
return Stats{ | ||
XPub: collector.RegisterGauge(xpubGaugeName), | ||
Utxo: collector.RegisterGauge(utxoGaugeName), | ||
Paymail: collector.RegisterGauge(paymailGaugeName), | ||
Destination: collector.RegisterGauge(destinationGaugeName), | ||
AccessKey: collector.RegisterGauge(accessKeyGaugeName), | ||
} | ||
// SetAccessKeyCount adds a value to the stats gauge with the label "access_key | ||
func (m *Metrics) SetAccessKeyCount(value int64) { | ||
m.stats.WithLabelValues("access_key").Set(float64(value)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters