Closed rafaelzimmermann closed 1 year ago
@rafaelzimmermann this may break existing tests that didn't specify tags before.
def test_statsd_increment_compound_without_explicit_tags_using_and_matched
matcher_1 = StatsD::Instrument::Matchers::Increment.new(:c, "counter", times: 1)
matcher_2 = StatsD::Instrument::Matchers::Increment.new(:c, "counter", times: 1)
assert(matcher_1.and(matcher_2).matches?(lambda {
StatsD.increment("counter", tags: ["a"])
StatsD.increment("counter", tags: ["b"])
}))
end
Previously the matcher filtered out metrics based on type and name to test against expectation. So, when the user tried to assert different different tags, the matcher would fail. With this change, the matcher will filter out metrics also based on tags too, allowing the user to use RSpec
and
expectation.For instance this test would fail before:
fixes: https://github.com/Shopify/statsd-instrument/issues/300