def process_message(self, message):

        (alarm_id, metrics, new_state, old_state, link, lifecycle_state,
         state_change_reason, sub_alarms_json_snake_case, tenant_id,
         time_stamp) = parse_alarm_state_hist_message(message)

        ts = time_stamp / 1000.0

        data = {
            "measurement":
            'alarm_state_history',
            "time":
            datetime.fromtimestamp(
                ts, tz=pytz.utc).strftime('%Y-%m-%dT%H:%M:%S.%fZ'),
            "fields": {
                "tenant_id": tenant_id.encode('utf8'),
                "alarm_id": alarm_id.encode('utf8'),
                "metrics": json.dumps(metrics,
                                      ensure_ascii=False).encode('utf8'),
                "new_state": new_state.encode('utf8'),
                "old_state": old_state.encode('utf8'),
                "link": link.encode('utf8'),
                "lifecycle_state": lifecycle_state.encode('utf8'),
                "reason": state_change_reason.encode('utf8'),
                "reason_data": "{}".encode('utf8'),
                "sub_alarms": sub_alarms_json_snake_case.encode('utf8')
            },
            "tags": {
                "tenant_id": tenant_id.encode('utf8')
            }
        }

        LOG.debug(data)

        return data
    def process_message(self, message):

        (alarm_id, metrics, new_state, old_state, link,
         lifecycle_state, state_change_reason,
         sub_alarms_json_snake_case, tenant_id,
         time_stamp) = parse_alarm_state_hist_message(
                message)

        ts = time_stamp / 1000.0

        data = {"measurement": 'alarm_state_history',
                "time": datetime.fromtimestamp(ts, tz=pytz.utc).strftime(
                        '%Y-%m-%dT%H:%M:%S.%fZ'),
                "fields": {
                    "tenant_id": tenant_id.encode('utf8'),
                    "alarm_id": alarm_id.encode('utf8'),
                    "metrics": json.dumps(metrics, ensure_ascii=False).encode(
                            'utf8'),
                    "new_state": new_state.encode('utf8'),
                    "old_state": old_state.encode('utf8'),
                    "link": link.encode('utf8'),
                    "lifecycle_state": lifecycle_state.encode('utf8'),
                    "reason": state_change_reason.encode('utf8'),
                    "reason_data": "{}".encode('utf8'),
                    "sub_alarms": sub_alarms_json_snake_case.encode('utf8')
                },
                "tags": {
                    "tenant_id": tenant_id.encode('utf8')
                }}

        LOG.debug(data)

        return data
    def process_message(self, message):

        (alarm_id, metrics, new_state, old_state, link,
         lifecycle_state, state_change_reason,
         sub_alarms_json_snake_case, tenant_id,
         time_stamp) = parse_alarm_state_hist_message(
                message)

        alarm_state_hist = (
            tenant_id.encode('utf8'),
            alarm_id.encode('utf8'),
            json.dumps(metrics, ensure_ascii=False).encode(
                    'utf8'),
            new_state.encode('utf8'),
            old_state.encode('utf8'),
            state_change_reason.encode('utf8'),
            "{}".encode('utf8'),
            sub_alarms_json_snake_case.encode('utf8'),
            time_stamp
        )

        LOG.debug(alarm_state_hist)

        return alarm_state_hist