File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,18 @@ func Start(cfg *config.Config) error {
4242 metrics .SetMetricPath ("/" )
4343 // Use metrics middleware without exposing path in main app router
4444 metrics .UseWithoutExposingEndpoint (router )
45+
46+ // Custom metric
47+ submittedMetric := & ginmetrics.Metric {
48+ // This is a Gauge because input-output-hk's is a gauge
49+ Type : ginmetrics .Gauge ,
50+ Name : "tx_submit_count" ,
51+ Description : "transactions submitted" ,
52+ Labels : nil ,
53+ }
54+ // Add to global monitor object
55+ _ = ginmetrics .GetMonitor ().AddMetric (submittedMetric )
56+
4557 // Start metrics listener
4658 go func () {
4759 // TODO: return error if we cannot initialize metrics
@@ -99,6 +111,8 @@ func handleSubmitTx(c *gin.Context) {
99111 // Return transaction ID
100112 c .String (202 , txIdHex )
101113 doneChan <- true
114+ // Increment custom metric
115+ _ = ginmetrics .GetMonitor ().GetMetric ("tx_submit_count" ).Inc (nil )
102116 return nil
103117 },
104118 RejectTxFunc : func (reason interface {}) error {
You can’t perform that action at this time.
0 commit comments