How to use the carbonate.sieve.filterMetrics function in carbonate

To help you get started, we’ve selected a few carbonate examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github graphite-project / carbonate / tests / test_sieve.py View on Github external
node2 = '2.2.2.2'
        node2_long = '2.2.2.2:2003:0'
        output2 = ['metric.100',
                  'metric.104',
                  'metric.106',
                  'metric.109']

        f = list(carbonate.sieve.filterMetrics(inputs, node, self.cluster))
        self.assertEqual(f, output)
        f = list(carbonate.sieve.filterMetrics(inputs, node_long, self.cluster))
        self.assertEqual(f, output)

        f = list(carbonate.sieve.filterMetrics(inputs, node2, self.cluster))
        self.assertEqual(f, output2)
        f = list(carbonate.sieve.filterMetrics(inputs, node2_long, self.cluster))
        self.assertEqual(f, output2)

        f = list(carbonate.sieve.filterMetrics(inputs, node, self.cluster, True))
        self.assertEqual(f, output2)

        f = list(carbonate.sieve.filterMetrics(inputs, node2, self.cluster, True))
        self.assertEqual(f, output)
github graphite-project / carbonate / tests / test_sieve.py View on Github external
'metric.102',
                  'metric.103',
                  'metric.105',
                  'metric.107',
                  'metric.108']

        node2 = '2.2.2.2'
        node2_long = '2.2.2.2:2003:0'
        output2 = ['metric.100',
                  'metric.104',
                  'metric.106',
                  'metric.109']

        f = list(carbonate.sieve.filterMetrics(inputs, node, self.cluster))
        self.assertEqual(f, output)
        f = list(carbonate.sieve.filterMetrics(inputs, node_long, self.cluster))
        self.assertEqual(f, output)

        f = list(carbonate.sieve.filterMetrics(inputs, node2, self.cluster))
        self.assertEqual(f, output2)
        f = list(carbonate.sieve.filterMetrics(inputs, node2_long, self.cluster))
        self.assertEqual(f, output2)

        f = list(carbonate.sieve.filterMetrics(inputs, node, self.cluster, True))
        self.assertEqual(f, output2)

        f = list(carbonate.sieve.filterMetrics(inputs, node2, self.cluster, True))
        self.assertEqual(f, output)
github graphite-project / carbonate / tests / test_sieve.py View on Github external
'metric.107',
                  'metric.108']

        node2 = '2.2.2.2'
        node2_long = '2.2.2.2:2003:0'
        output2 = ['metric.100',
                  'metric.104',
                  'metric.106',
                  'metric.109']

        f = list(carbonate.sieve.filterMetrics(inputs, node, self.cluster))
        self.assertEqual(f, output)
        f = list(carbonate.sieve.filterMetrics(inputs, node_long, self.cluster))
        self.assertEqual(f, output)

        f = list(carbonate.sieve.filterMetrics(inputs, node2, self.cluster))
        self.assertEqual(f, output2)
        f = list(carbonate.sieve.filterMetrics(inputs, node2_long, self.cluster))
        self.assertEqual(f, output2)

        f = list(carbonate.sieve.filterMetrics(inputs, node, self.cluster, True))
        self.assertEqual(f, output2)

        f = list(carbonate.sieve.filterMetrics(inputs, node2, self.cluster, True))
        self.assertEqual(f, output)
github graphite-project / carbonate / tests / test_sieve.py View on Github external
output2 = ['metric.100',
                  'metric.104',
                  'metric.106',
                  'metric.109']

        f = list(carbonate.sieve.filterMetrics(inputs, node, self.cluster))
        self.assertEqual(f, output)
        f = list(carbonate.sieve.filterMetrics(inputs, node_long, self.cluster))
        self.assertEqual(f, output)

        f = list(carbonate.sieve.filterMetrics(inputs, node2, self.cluster))
        self.assertEqual(f, output2)
        f = list(carbonate.sieve.filterMetrics(inputs, node2_long, self.cluster))
        self.assertEqual(f, output2)

        f = list(carbonate.sieve.filterMetrics(inputs, node, self.cluster, True))
        self.assertEqual(f, output2)

        f = list(carbonate.sieve.filterMetrics(inputs, node2, self.cluster, True))
        self.assertEqual(f, output)
github graphite-project / carbonate / carbonate / cli.py View on Github external
match_dests = [args.node]
    else:
        match_dests = local_addresses()

    try:
        for metric in fileinput.input(fi):
            if args.field is None:
                m = metric.strip()
            else:
                fields = metric.split(args.field_separator)
                try:
                    m = fields[int(args.field)-1].strip()
                except IndexError:
                    raise SystemExit("Field index is out-of-bounds")

            for match in filterMetrics([m], match_dests, cluster, invert):
                print metric.strip()
    except KeyboardInterrupt:
        sys.exit(1)
github graphite-project / carbonate / carbonate / cli.py View on Github external
match_dests = [args.node]
    else:
        match_dests = local_addresses()

    try:
        for metric in fileinput.input(fi):
            if args.field is None:
                m = metric.strip()
            else:
                fields = metric.split(args.field_separator)
                try:
                    m = fields[int(args.field)-1].strip()
                except IndexError:
                    raise SystemExit("Field index is out-of-bounds")

            for match in filterMetrics([m], match_dests, cluster, invert):
                print metric.strip()
    except KeyboardInterrupt:
        sys.exit(1)