Code Duplication    Length = 16-16 lines in 2 locations

glances/exports/glances_influxdb2/__init__.py 1 location

@@ 162-177 (lines=16) @@
159
            ret.append({'measurement': name, 'tags': tags, 'fields': fields})
160
        return ret
161
162
    def export(self, name, columns, points):
163
        """Write the points to the InfluxDB server."""
164
        # Manage prefix
165
        if self.prefix is not None:
166
            name = self.prefix + '.' + name
167
        # Write input to the InfluxDB database
168
        if len(points) == 0:
169
            logger.debug("Cannot export empty {} stats to InfluxDB".format(name))
170
        else:
171
            try:
172
                self.client.write(self.bucket, self.org, self._normalize(name, columns, points), time_precision="s")
173
            except Exception as e:
174
                # Log level set to debug instead of error (see: issue #1561)
175
                logger.debug("Cannot export {} stats to InfluxDB ({})".format(name, e))
176
            else:
177
                logger.debug("Export {} stats to InfluxDB".format(name))
178

glances/exports/glances_influxdb/__init__.py 1 location

@@ 151-166 (lines=16) @@
148
            ret.append({'measurement': name, 'tags': tags, 'fields': fields})
149
        return ret
150
151
    def export(self, name, columns, points):
152
        """Write the points to the InfluxDB server."""
153
        # Manage prefix
154
        if self.prefix is not None:
155
            name = self.prefix + '.' + name
156
        # Write input to the InfluxDB database
157
        if len(points) == 0:
158
            logger.debug("Cannot export empty {} stats to InfluxDB".format(name))
159
        else:
160
            try:
161
                self.client.write_points(self._normalize(name, columns, points), time_precision="s")
162
            except Exception as e:
163
                # Log level set to debug instead of error (see: issue #1561)
164
                logger.debug("Cannot export {} stats to InfluxDB ({})".format(name, e))
165
            else:
166
                logger.debug("Export {} stats to InfluxDB".format(name))
167