worryg0d commented on code in PR #1912:
URL:
https://github.com/apache/cassandra-gocql-driver/pull/1912#discussion_r2377948952
##########
session.go:
##########
@@ -944,14 +949,26 @@ func (qm *queryMetrics) attempt(addAttempts int,
addLatency time.Duration,
updateHostMetrics.Attempts += addAttempts
updateHostMetrics.TotalLatency += addLatency.Nanoseconds()
- var hostMetricsCopy *hostMetrics
- if needsHostMetrics {
- hostMetricsCopy = new(hostMetrics)
- *hostMetricsCopy = *updateHostMetrics
- }
-
qm.l.Unlock()
- return totalAttempts, hostMetricsCopy
+ return totalAttempts, updateHostMetrics
+}
+
+var nilHostMetrics = &hostMetrics{}
Review Comment:
I think the `nil` prefix is misleading, because value of this var is not
actually nil. Probably the `empty` prefix is better?
The same applies to `nilQueryMetricsImpl`
##########
session.go:
##########
@@ -1500,11 +1530,17 @@ func (iter *Iter) Columns() []ColumnInfo {
}
// Attempts returns the number of times the statement was executed.
+//
+// Set Query.WithQueryMetrics to true
+// so that this Attempts metric is available, otherwise this method will
always return 0.
Review Comment:
From what I understand, attempts are always available, so this comment is
not true
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]