Adding eventDateTime to all event generation locations

This commit is contained in:
Chip Childers 2013-09-03 11:34:56 -04:00
parent e48e75625d
commit 14ee684ce3
7 changed files with 42 additions and 0 deletions

View File

@ -17,6 +17,8 @@
package com.cloud.event;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@ -189,6 +191,10 @@ public class ActionEventUtils {
eventDescription.put("status", state.toString());
eventDescription.put("entity", entityType);
eventDescription.put("entityuuid", entityUuid);
String eventDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
eventDescription.put("eventDateTime", eventDate);
event.setDescription(eventDescription);
try {

View File

@ -31,8 +31,10 @@ import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.text.SimpleDateFormat;
@Component
public class AlertGenerator {
@ -83,6 +85,10 @@ public class AlertGenerator {
} else {
eventDescription.put("podId", null);
}
String eventDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
eventDescription.put("eventDateTime", eventDate);
event.setDescription(eventDescription);
try {

View File

@ -33,6 +33,8 @@ import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@ -148,6 +150,10 @@ public class UsageEventUtils {
eventDescription.put("event", usageEventType);
eventDescription.put("resource", resourceType);
eventDescription.put("id", resourceUUID);
String eventDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
eventDescription.put("eventDateTime", eventDate);
event.setDescription(eventDescription);
try {

View File

@ -31,6 +31,8 @@ import org.apache.log4j.Logger;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import javax.inject.Inject;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@ -80,6 +82,10 @@ public class NetworkStateListener implements StateListener<State, Event, Network
eventDescription.put("id", vo.getUuid());
eventDescription.put("old-state", oldState.name());
eventDescription.put("new-state", newState.name());
String eventDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
eventDescription.put("eventDateTime", eventDate);
eventMsg.setDescription(eventDescription);
try {
_eventBus.publish(eventMsg);

View File

@ -34,6 +34,8 @@ import com.cloud.storage.SnapshotVO;
import com.cloud.utils.fsm.StateListener;
import com.cloud.utils.component.ComponentContext;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@ -79,6 +81,10 @@ public class SnapshotStateListener implements StateListener<State, Event, Snapsh
eventDescription.put("id", vo.getUuid());
eventDescription.put("old-state", oldState.name());
eventDescription.put("new-state", newState.name());
String eventDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
eventDescription.put("eventDateTime", eventDate);
eventMsg.setDescription(eventDescription);
try {
_eventBus.publish(eventMsg);

View File

@ -29,6 +29,8 @@ import org.apache.cloudstack.framework.events.EventBusException;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@ -74,6 +76,10 @@ public class VolumeStateListener implements StateListener<State, Event, Volume>
eventDescription.put("id", vo.getUuid());
eventDescription.put("old-state", oldState.name());
eventDescription.put("new-state", newState.name());
String eventDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
eventDescription.put("eventDateTime", eventDate);
eventMsg.setDescription(eventDescription);
try {
_eventBus.publish(eventMsg);

View File

@ -34,6 +34,8 @@ import org.apache.log4j.Logger;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import javax.inject.Inject;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -116,6 +118,10 @@ public class UserVmStateListener implements StateListener<State, VirtualMachine.
eventDescription.put("id", vo.getUuid());
eventDescription.put("old-state", oldState.name());
eventDescription.put("new-state", newState.name());
String eventDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
eventDescription.put("eventDateTime", eventDate);
eventMsg.setDescription(eventDescription);
try {
_eventBus.publish(eventMsg);