Beispiel #1
0
    def save_many(self, reports: List[Report], report_model: ReportModel):
        """
        Save a batch of data

        :param reports: Batch of data.
        :param report_model: ReportModel
        """
        value = report_model.to_prometheus(reports[0].serialize())
        key = ''.join([value['tags'][tag] for tag in self.report_model.get_tags()])
        for report in reports:
            value = report_model.to_prometheus(report.serialize())
            self.buffer.append(value, key)
        self._expose_data(key)
Beispiel #2
0
    def save(self, report: Report, report_model: ReportModel):
        """
        Override from BaseDB

        :param report: Report to save
        :param report_model: ReportModel
        """
        self.collection.insert_one(report_model.to_mongodb(report.serialize()))
Beispiel #3
0
    def save_many(self, reports: List[Report], report_model: ReportModel):
        """
        Allow to save a batch of data

        :param reports: Batch of data.
        :param report_model: ReportModel
        """
        serialized_reports = list(
            map(lambda r: report_model.to_mongodb(r.serialize()), reports))
        self.collection.insert_many(serialized_reports)
Beispiel #4
0
    def save(self, report: Report, report_model: ReportModel):
        """
        Override from BaseDB

        :param report: Report to save
        :param report_model: ReportModel
        """

        data = report_model.to_influxdb(report.serialize())
        self.client.write_points([data])
Beispiel #5
0
    def save_many(self, reports: List[Report], report_model: ReportModel):
        """
        Save a batch of data

        :param reports: Batch of data.
        :param report_model: ReportModel
        """

        data_list = list(
            map(lambda r: report_model.to_influxdb(r.serialize()), reports))
        self.client.write_points(data_list)
Beispiel #6
0
    def save(self, report: Report, report_model: ReportModel):
        """
        Override from BaseDB

        :param report: Report to save
        :param report_model: ReportModel
        """

        value = report_model.to_prometheus(report.serialize())

        key = ''.join([value['tags'][tag] for tag in self.report_model.get_tags()])
        self.buffer.append(value, key)
        self._expose_data(key)