alloydb-go-connector icon indicating copy to clipboard operation
alloydb-go-connector copied to clipboard

wantLastValueMetric() is not verifying the last value of a metric

Open rhatgadkar-goog opened this issue 5 months ago • 2 comments

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?

rhatgadkar-goog avatar Sep 18 '24 23:09 rhatgadkar-goog