When aggregation is enabled, statsd-instrument attempts to Array#sort!. This breaks things when frozen arrays are used, as it attempts to mutate the array.
This blew up in production for me since our test suite doesn't enable aggregation, since doing so would cause assert_statsd_* assertions to fail.
Ideally, we wouldn't need to call Array#sort because that incurs an allocation. In my specific case, the array was a simple TAGS = ["foo:bar"].freeze, so sorting was not even necessary. If we must sort, maybe a good middle ground would be something like:
if tags.length > 1
tags.sort
else
tags
end
Thoughts?
cc: @pedro-stanaka since you've been working on this feature