Code Duplication    Length = 24-24 lines in 2 locations

plumd/plugins/readers/redis.py 1 location

@@ 118-141 (lines=24) @@
115
        'retry_cnt': 3       # retry connection n times
116
    }
117
118
    def __init__(self, log, config):
119
        """Plugin to record redis metrics.
120
121
        :param log: A logger
122
        :type log: logging.RootLogger
123
        :param config: a plumd.config.Conf configuration helper instance.
124
        :type config: plumd.config.Conf
125
        """
126
        super(Redis, self).__init__(log, config)
127
        self.config.defaults(Redis.defaults)
128
129
        # metrics to record
130
        self.gauges = self.config.get('gauges')
131
        self.rates = self.config.get('rates')
132
133
        # Redis connection
134
        host = self.config.get('host')
135
        port = self.config.get('port')
136
        self.addr = (host, port)
137
        self.socket = None
138
        self.timeout = config.get('timeout')
139
        self.retry_time = config.get('retry_time')
140
        self.retry_cnt = config.get('retry_cnt')
141
        self.calc = Differential()
142
143
144
    def poll(self):

plumd/plugins/readers/memcache.py 1 location

@@ 99-122 (lines=24) @@
96
        'retry_cnt': 3       # retry connection n times
97
    }
98
99
    def __init__(self, log, config):
100
        """Plugin to record memcache stats.
101
102
        :param log: A logger
103
        :type log: logging.RootLogger
104
        :param config: a plumd.config.Conf configuration helper instance.
105
        :type config: plumd.config.Conf
106
        """
107
        super(Memcache, self).__init__(log, config)
108
        self.config.defaults(Memcache.defaults)
109
110
        # metrics to record
111
        self.gauges = self.config.get('gauges')
112
        self.rates = self.config.get('rates')
113
114
        # memcached connection
115
        host = self.config.get('host')
116
        port = self.config.get('port')
117
        self.addr = (host, port)
118
        self.socket = None
119
        self.timeout = config.get('timeout')
120
        self.retry_time = config.get('retry_time')
121
        self.retry_cnt = config.get('retry_cnt')
122
        self.calc = Differential()
123
124
125
    def poll(self):