add sample_timestamp and change update_timestamp
Change-Id: I562716e7cc7b4e4b5d7e6bbab3bd828a05b0096b
This commit is contained in:
@@ -11,15 +11,16 @@
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import copy
|
||||
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import importutils
|
||||
|
||||
from vitrage.common.constants import EdgeProperties as EProps
|
||||
from vitrage.common.constants import EntityType
|
||||
from vitrage.common.constants import SynchronizerProperties as SyncProps
|
||||
from vitrage.common.constants import SyncMode
|
||||
from vitrage.common.constants import VertexProperties as VProps
|
||||
from vitrage.common import datetime_utils
|
||||
from vitrage.evaluator.actions.base import ActionMode
|
||||
from vitrage.evaluator.actions.base import ActionType
|
||||
@@ -116,7 +117,8 @@ class ActionExecutor(object):
|
||||
|
||||
event[SyncProps.SYNC_MODE] = SyncMode.UPDATE
|
||||
event[SyncProps.SYNC_TYPE] = EntityType.VITRAGE
|
||||
event[EProps.UPDATE_TIMESTAMP] = str(datetime_utils.utcnow())
|
||||
event[VProps.UPDATE_TIMESTAMP] = str(datetime_utils.utcnow())
|
||||
event[VProps.SAMPLE_TIMESTAMP] = str(datetime_utils.utcnow())
|
||||
|
||||
@staticmethod
|
||||
def _register_action_recipes():
|
||||
|
||||
@@ -50,7 +50,8 @@ class EvaluatorEventTransformer(transformer_base.TransformerBase):
|
||||
if event_type == UPDATE_VERTEX:
|
||||
properties = {
|
||||
VProps.VITRAGE_STATE: event[VProps.VITRAGE_STATE],
|
||||
VProps.UPDATE_TIMESTAMP: event[VProps.UPDATE_TIMESTAMP]
|
||||
VProps.UPDATE_TIMESTAMP: event[VProps.UPDATE_TIMESTAMP],
|
||||
VProps.SAMPLE_TIMESTAMP: event[VProps.SAMPLE_TIMESTAMP]
|
||||
}
|
||||
return Vertex(event[VProps.VITRAGE_ID], properties)
|
||||
|
||||
@@ -58,6 +59,7 @@ class EvaluatorEventTransformer(transformer_base.TransformerBase):
|
||||
|
||||
metadata = {
|
||||
VProps.UPDATE_TIMESTAMP: event[VProps.UPDATE_TIMESTAMP],
|
||||
VProps.SAMPLE_TIMESTAMP: event[VProps.SAMPLE_TIMESTAMP],
|
||||
VProps.NAME: event[TFields.ALARM_NAME],
|
||||
VProps.SEVERITY: event[TFields.SEVERITY],
|
||||
VProps.STATE: event[VProps.STATE]
|
||||
@@ -66,7 +68,8 @@ class EvaluatorEventTransformer(transformer_base.TransformerBase):
|
||||
self.extract_key(event),
|
||||
entity_category=EntityCategory.ALARM,
|
||||
entity_type=VITRAGE_TYPE,
|
||||
update_timestamp=event[EProps.UPDATE_TIMESTAMP],
|
||||
update_timestamp=event[VProps.UPDATE_TIMESTAMP],
|
||||
sample_timestamp=event[VProps.SAMPLE_TIMESTAMP],
|
||||
metadata=metadata)
|
||||
|
||||
return None
|
||||
@@ -95,7 +98,8 @@ class EvaluatorEventTransformer(transformer_base.TransformerBase):
|
||||
|
||||
neighbor_props = {
|
||||
VProps.IS_PLACEHOLDER: True,
|
||||
EProps.UPDATE_TIMESTAMP: event[EProps.UPDATE_TIMESTAMP]
|
||||
VProps.UPDATE_TIMESTAMP: event[VProps.UPDATE_TIMESTAMP],
|
||||
VProps.SAMPLE_TIMESTAMP: event[VProps.SAMPLE_TIMESTAMP]
|
||||
}
|
||||
neighbor = Vertex(event[TFields.TARGET], neighbor_props)
|
||||
return [transformer_base.Neighbor(neighbor, relation_edge)]
|
||||
|
||||
@@ -88,7 +88,6 @@ class ScenarioEvaluator(object):
|
||||
ActionMode.DO))
|
||||
|
||||
if actions:
|
||||
LOG.info("About to perform %s actions", len(actions.values()))
|
||||
LOG.debug("Actions to perform: %s", actions.values())
|
||||
for action in actions.values():
|
||||
action_spce = action[0]
|
||||
|
||||
Reference in New Issue
Block a user