Skip to content

Commit dd7f1b0

Browse files
committed
fix: rename metric to match IOHK
see: IntersectMBO/cardano-node#3235 Signed-off-by: Chris Gianelloni <[email protected]>
1 parent 31f3adb commit dd7f1b0

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

internal/api/api.go

+9-9
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func Start(cfg *config.Config) error {
7878
failureMetric := &ginmetrics.Metric{
7979
// This is a Gauge because input-output-hk's is a gauge
8080
Type: ginmetrics.Gauge,
81-
Name: "tx_failure_count",
81+
Name: "tx_submit_fail_count",
8282
Description: "transactions failed",
8383
Labels: nil,
8484
}
@@ -138,7 +138,7 @@ func handleSubmitTx(c *gin.Context) {
138138
// Log the error, return an error to the user, and increment failed count
139139
logger.Errorf("invalid request body, should be application/cbor")
140140
c.Data(415, "application/json", []byte("invalid request body, should be application/cbor"))
141-
_ = ginmetrics.GetMonitor().GetMetric("tx_failure_count").Inc(nil)
141+
_ = ginmetrics.GetMonitor().GetMetric("tx_submit_fail_count").Inc(nil)
142142
return
143143
}
144144
// Read raw transaction bytes from the request body and store in a byte array
@@ -147,7 +147,7 @@ func handleSubmitTx(c *gin.Context) {
147147
// Log the error, return an error to the user, and increment failed count
148148
logger.Errorf("failed to read request body: %s", err)
149149
c.Data(500, "application/json", []byte("failed to read request body"))
150-
_ = ginmetrics.GetMonitor().GetMetric("tx_failure_count").Inc(nil)
150+
_ = ginmetrics.GetMonitor().GetMetric("tx_submit_fail_count").Inc(nil)
151151
return
152152
}
153153
// Close request body after read
@@ -159,7 +159,7 @@ func handleSubmitTx(c *gin.Context) {
159159
if err := cbor.Unmarshal(txRawBytes, &txUnwrap); err != nil {
160160
logger.Errorf("failed to unwrap transaction CBOR: %s", err)
161161
c.Data(400, "application/json", []byte(fmt.Sprintf("failed to unwrap transaction CBOR: %s", err)))
162-
_ = ginmetrics.GetMonitor().GetMetric("tx_failure_count").Inc(nil)
162+
_ = ginmetrics.GetMonitor().GetMetric("tx_submit_fail_count").Inc(nil)
163163
return
164164
}
165165
// index 0 is the transaction body
@@ -188,21 +188,21 @@ func handleSubmitTx(c *gin.Context) {
188188
if err != nil {
189189
logger.Errorf("failure creating Ouroboros connection: %s", err)
190190
c.Data(500, "application/json", []byte("failure communicating with node"))
191-
_ = ginmetrics.GetMonitor().GetMetric("tx_failure_count").Inc(nil)
191+
_ = ginmetrics.GetMonitor().GetMetric("tx_submit_fail_count").Inc(nil)
192192
return
193193
}
194194
if cfg.Node.Address != "" && cfg.Node.Port > 0 {
195195
if err := oConn.Dial("tcp", fmt.Sprintf("%s:%d", cfg.Node.Address, cfg.Node.Port)); err != nil {
196196
logger.Errorf("failure connecting to node via TCP: %s", err)
197197
c.Data(500, "application/json", []byte("failure communicating with node"))
198-
_ = ginmetrics.GetMonitor().GetMetric("tx_failure_count").Inc(nil)
198+
_ = ginmetrics.GetMonitor().GetMetric("tx_submit_fail_count").Inc(nil)
199199
return
200200
}
201201
} else {
202202
if err := oConn.Dial("unix", cfg.Node.SocketPath); err != nil {
203203
logger.Errorf("failure connecting to node via UNIX socket: %s", err)
204204
c.Data(500, "application/json", []byte("failure communicating with node"))
205-
_ = ginmetrics.GetMonitor().GetMetric("tx_failure_count").Inc(nil)
205+
_ = ginmetrics.GetMonitor().GetMetric("tx_submit_fail_count").Inc(nil)
206206
return
207207
}
208208
}
@@ -212,7 +212,7 @@ func handleSubmitTx(c *gin.Context) {
212212
if ok {
213213
logger.Errorf("failure communicating with node: %s", err)
214214
c.Data(500, "application/json", []byte("failure communicating with node"))
215-
_ = ginmetrics.GetMonitor().GetMetric("tx_failure_count").Inc(nil)
215+
_ = ginmetrics.GetMonitor().GetMetric("tx_submit_fail_count").Inc(nil)
216216
doneChan <- true
217217
}
218218
}()
@@ -235,7 +235,7 @@ func handleSubmitTx(c *gin.Context) {
235235
}
236236
doneChan <- true
237237
// Increment custom metric
238-
_ = ginmetrics.GetMonitor().GetMetric("tx_failure_count").Inc(nil)
238+
_ = ginmetrics.GetMonitor().GetMetric("tx_submit_fail_count").Inc(nil)
239239
return nil
240240
},
241241
}

0 commit comments

Comments
 (0)