(self)
Assert no duplicate metrics have been submitted.

        Metrics are considered duplicate when all following fields match:

        - metric name
        - type (gauge, rate, etc)
        - tags
        - hostname
Assert no duplicate metrics have been submitted.
Assert no duplicate metrics have been submitted .
def assert_no_duplicate_metrics(self):
        """
        Assert no duplicate metrics have been submitted.

        Metrics are considered duplicate when all following fields match:

        - metric name
        - type (gauge, rate, etc)
        - tags
        - hostname
        """
        # metric types that intended to be called multiple times are ignored
        ignored_types = [self.COUNT, self.COUNTER]
        metric_stubs = [m for metrics in self._metrics.values() for m in metrics if m.type not in ignored_types]

        def stub_to_key_fn(stub):
            return stub.name, stub.type, str(sorted(stub.tags)), stub.hostname

        self._assert_no_duplicate_stub('metric', metric_stubs, stub_to_key_fn)
def assert_no_duplicate_metrics ( self ) : # metric types that intended to be called multiple times are ignored ignored_types = [ self . COUNT , self . COUNTER ] metric_stubs = [ m for metrics in self . _metrics . values ( ) for m in metrics if m . type not in ignored_types ] def stub_to_key_fn ( stub ) : return stub . name , stub . type , str ( sorted ( stub . tags ) ) , stub . hostname self . _assert_no_duplicate_stub ( 'metric' , metric_stubs , stub_to_key_fn )