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