Complete Example for Rest custom Collector.
RestCollector(BatchCollector): def __init__(self, logger, config: dict) -> None: self._config = config super(BatchCollector, self).__init__(logger, config) def collect(self): self._logger.info("started collect()") configuration = RestConfiguration() //set configuration try: res = rest_client.RestClient(configuration=configuration).call_api("/httpdemo", 'GET', _preload_content=False, _return_http_data_only=True) if res.status == 200: string = res.read().decode('utf-8') collected_data = json.loads(string) return collected_data except Exception as e: self._logger.error("error in processing data %s", e.__cause__) def transform(self): collected_data = self._collected_data # apply custom transform on collected object self._logger.info("started transform on data %s", collected_data) output_data = {} output_data['instance'] =collected_data.get("labels").get("instance") // other output data properties metric = TCOMetric(output_data.get("instance"), output_data.get("metricType"), output_data.get("timestamp"), ...) return metric