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)
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()))
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)
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])
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)
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)