From 4ef76e8792e850c6a520eef4fec5338fec18c4ce Mon Sep 17 00:00:00 2001 From: Vitaliy Skypnyk Date: Wed, 10 Nov 2021 21:56:26 +0000 Subject: [PATCH] Refactor code --- influxdb_writter.py | 2 +- keentic_influxdb_exporter.py | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/influxdb_writter.py b/influxdb_writter.py index 3b504b8..6ef18a9 100644 --- a/influxdb_writter.py +++ b/influxdb_writter.py @@ -15,4 +15,4 @@ class InfuxWriter(object): logging.info("Connecting to InfluxDB: " + self._configuration['url']) def write_metrics(self, metrics): - self._write_api.write(bucket=self._configuration['bucket'], record=metrics) + self._write_api.write(bucket=self._configuration['bucket'], org=self._configuration['org'], record=metrics) diff --git a/keentic_influxdb_exporter.py b/keentic_influxdb_exporter.py index 3ce356b..5902292 100644 --- a/keentic_influxdb_exporter.py +++ b/keentic_influxdb_exporter.py @@ -4,7 +4,6 @@ import logging import os import time from typing import Dict, List -from influxdb_client.client.write.point import Point from jsonpath_rw import parse @@ -81,12 +80,12 @@ class KeeneticCollector(object): @staticmethod def create_metric(measurement, tags, values): - return Point.from_dict({ + return { "measurement": measurement, "tags": tags, "time": time.time_ns(), "fields": values - }) + } @staticmethod def get_first_value(array):