code: def send_to_tsdb(self, realm, host, service, metrics, ts, path):
          
          if ts is None:
              ts = int(time.time())
  
          data = {
              "measurement": service,
              "tags": {
                  "host": host,
                  "service": service,
                  "realm": '.'.join(realm) if isinstance(realm, list) else realm,
                  "path": path
              },
              "time": ts,
              "fields": {}
          }
  
          if path is not None:
              data['tags'].update({"path": path})
  
          for metric, value, _ in metrics:
              data['fields'].update({metric: value})
  
          # Flush if necessary
          logger.debug("Data: %s", data)
          self.my_metrics.append(data)
  
          if self.metrics_count >= self.metrics_flush_count:
              # self.carbon.add_data_list(self.my_metrics)
              self.flush()
docs: Send performance data to time series database
  
          Indeed this function stores metrics in the internal cache and checks if the flushing
          is necessary and then flushes.
  
          :param realm: concerned realm
          :type: string
          :param host: concerned host
          :type: string
          :param service: concerned service
          :type: string
          :param metrics: list of metrics couple (name, value)
          :type: list
          :param ts: timestamp
          :type: int
          :param path: full path (eg. Graphite) for the received metrics
          :type: string