fix: only take the first item in a comma-separated list for pg attrs #142
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In a recent upstream PR1, a change was made that introduced the
possibility of the
conninfo_hash
containing a comma-separated list ifthe hostname we connect to resolves to multiple IP addresses.
In the tests, we say to connect to
localhost
: and sure enough, thatresolves to both
127.0.0.1
and::1
. 🤦I considered simply relaxing the validation here, but we'd break
semantic conventions:
net.peer.port
must be an integer, not a string -so we can't just pass through the unmodified values. The values will
always be duplicate, comma-separated strings however: the actual
difference shows up in
net.peer.ip
.Anyways, we add a helper function that tries to be smart about not doing
more work than is necessary.
Footnotes
https://github.com/ged/ruby-pg/pull/485 ↩