alloydb-go-connector
alloydb-go-connector copied to clipboard
wantLastValueMetric() is not verifying the last value of a metric
This line passes in TestDialerWithMetrics
if the wanted value is set to 1
. This is because wantLastValueMetric()
is not correctly verifying the last value of a metric. It currently checks whether at some point in time the metric had the wanted value, as seen from these lines.
In TestDialerWithMetrics
, the "alloydbconn/open_connections" metric had the following values at different times:
m.name = alloydbconn/open_connections, d.Value = 1
m.name = alloydbconn/open_connections, d.Value = 1
m.name = alloydbconn/open_connections, d.Value = 1
m.name = alloydbconn/open_connections, d.Value = 1
m.name = alloydbconn/open_connections, d.Value = 1
m.name = alloydbconn/open_connections, d.Value = 2
Should we fix wantLastValueMetric()
so that it looks at the latest value of the metric?