Pass link and lifecycle state in state transitions
Requires changes to monasca-thresh Change-Id: I93113bc854629d45f34cdff9205ee97f353f999a
This commit is contained in:
parent
ec2096fbbb
commit
7b4b41ff28
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
* (C) Copyright 2014-2016 Hewlett Packard Enterprise Development Company LP
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -146,6 +146,24 @@ public class InfluxV9AlarmRepo extends InfluxAlarmRepo {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (event.link == null) {
|
||||||
|
|
||||||
|
valueMap.put("link", "");
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
valueMap.put("link", event.link);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.lifecycleState == null) {
|
||||||
|
|
||||||
|
valueMap.put("lifecycle_state", "");
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
valueMap.put("lifecycle_state", event.lifecycleState);
|
||||||
|
}
|
||||||
|
|
||||||
if (event.subAlarms == null) {
|
if (event.subAlarms == null) {
|
||||||
|
|
||||||
logger.debug("[{}]: sub alarms is null. Setting sub alarms to empty JSON", id);
|
logger.debug("[{}]: sub alarms is null. Setting sub alarms to empty JSON", id);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
# (C) Copyright 2014-2016 Hewlett Packard Enterprise Development Company LP
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@ -484,7 +484,8 @@ class AlarmStateHistInfluxdbPersister(AbstractInfluxdbPersister):
|
|||||||
|
|
||||||
def process_message(self, message):
|
def process_message(self, message):
|
||||||
|
|
||||||
(alarm_id, metrics, new_state, old_state, state_change_reason,
|
(alarm_id, metrics, new_state, old_state, link,
|
||||||
|
lifecycle_state, state_change_reason,
|
||||||
sub_alarms_json_snake_case, tenant_id,
|
sub_alarms_json_snake_case, tenant_id,
|
||||||
time_stamp) = parse_alarm_state_hist_message(
|
time_stamp) = parse_alarm_state_hist_message(
|
||||||
message)
|
message)
|
||||||
@ -501,6 +502,8 @@ class AlarmStateHistInfluxdbPersister(AbstractInfluxdbPersister):
|
|||||||
'utf8'),
|
'utf8'),
|
||||||
"new_state": new_state.encode('utf8'),
|
"new_state": new_state.encode('utf8'),
|
||||||
"old_state": old_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": state_change_reason.encode('utf8'),
|
||||||
"reason_data": "{}".encode('utf8'),
|
"reason_data": "{}".encode('utf8'),
|
||||||
"sub_alarms": sub_alarms_json_snake_case.encode('utf8')
|
"sub_alarms": sub_alarms_json_snake_case.encode('utf8')
|
||||||
@ -630,6 +633,12 @@ def parse_alarm_state_hist_message(message):
|
|||||||
old_state = alarm_transitioned['oldState']
|
old_state = alarm_transitioned['oldState']
|
||||||
LOG.debug('old state: %s', old_state)
|
LOG.debug('old state: %s', old_state)
|
||||||
|
|
||||||
|
link = alarm_transitioned['link'] or ""
|
||||||
|
LOG.debug('link: %s', link)
|
||||||
|
|
||||||
|
lifecycle_state = alarm_transitioned['lifecycleState'] or ""
|
||||||
|
LOG.debug('lifecycle_state: %s', lifecycle_state)
|
||||||
|
|
||||||
state_change_reason = alarm_transitioned[
|
state_change_reason = alarm_transitioned[
|
||||||
'stateChangeReason']
|
'stateChangeReason']
|
||||||
LOG.debug('state change reason: %s', state_change_reason)
|
LOG.debug('state change reason: %s', state_change_reason)
|
||||||
@ -661,7 +670,8 @@ def parse_alarm_state_hist_message(message):
|
|||||||
|
|
||||||
sub_alarms_json_snake_case = "[]"
|
sub_alarms_json_snake_case = "[]"
|
||||||
|
|
||||||
return (alarm_id, metrics, new_state, old_state, state_change_reason,
|
return (alarm_id, metrics, new_state, old_state, link,
|
||||||
|
lifecycle_state, state_change_reason,
|
||||||
sub_alarms_json_snake_case, tenant_id, time_stamp)
|
sub_alarms_json_snake_case, tenant_id, time_stamp)
|
||||||
|
|
||||||
def main_service():
|
def main_service():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user