| @@ 118-136 (lines=19) @@ | ||
| 115 | 'tags': self.parse_tags(self.tags), |
|
| 116 | 'fields': dict(zip(columns, points))}] |
|
| 117 | ||
| 118 | def export(self, name, columns, points): |
|
| 119 | """Write the points to the InfluxDB server.""" |
|
| 120 | # Manage prefix |
|
| 121 | if self.prefix is not None: |
|
| 122 | name = self.prefix + '.' + name |
|
| 123 | # Write input to the InfluxDB database |
|
| 124 | if len(points) == 0: |
|
| 125 | logger.debug("Cannot export empty {} stats to InfluxDB".format(name)) |
|
| 126 | else: |
|
| 127 | try: |
|
| 128 | self.client.write(self.bucket, |
|
| 129 | self.org, |
|
| 130 | self._normalize(name, columns, points), |
|
| 131 | time_precision="s") |
|
| 132 | except Exception as e: |
|
| 133 | # Log level set to debug instead of error (see: issue #1561) |
|
| 134 | logger.debug("Cannot export {} stats to InfluxDB ({})".format(name, e)) |
|
| 135 | else: |
|
| 136 | logger.debug("Export {} stats to InfluxDB".format(name)) |
|
| 137 | ||
| @@ 123-138 (lines=16) @@ | ||
| 120 | 'tags': self.parse_tags(self.tags), |
|
| 121 | 'fields': dict(zip(columns, points))}] |
|
| 122 | ||
| 123 | def export(self, name, columns, points): |
|
| 124 | """Write the points to the InfluxDB server.""" |
|
| 125 | # Manage prefix |
|
| 126 | if self.prefix is not None: |
|
| 127 | name = self.prefix + '.' + name |
|
| 128 | # Write input to the InfluxDB database |
|
| 129 | if len(points) == 0: |
|
| 130 | logger.debug("Cannot export empty {} stats to InfluxDB".format(name)) |
|
| 131 | else: |
|
| 132 | try: |
|
| 133 | self.client.write_points(self._normalize(name, columns, points), time_precision="s") |
|
| 134 | except Exception as e: |
|
| 135 | # Log level set to debug instead of error (see: issue #1561) |
|
| 136 | logger.debug("Cannot export {} stats to InfluxDB ({})".format(name, e)) |
|
| 137 | else: |
|
| 138 | logger.debug("Export {} stats to InfluxDB".format(name)) |
|
| 139 | ||