AlarmStateTransitionedEvent timestamp now in ms

This will ensure a unique timestamp. Influx will only keep one
entry with the same timestamp

Change-Id: Ibf1001fea9328a6541381d344221b86e39996e1d
This commit is contained in:
Craig Bryant 2015-04-14 11:13:43 -06:00
parent e3ac4b0857
commit 6bdef9f492
2 changed files with 4 additions and 4 deletions

View File

@ -238,7 +238,7 @@ public class AlarmThresholdingBolt extends BaseRichBolt {
}
protected long getTimestamp() {
return System.currentTimeMillis() / 1000;
return System.currentTimeMillis();
}
void handleAlarmDeleted(String alarmId) {

View File

@ -125,7 +125,7 @@ public class AlarmThresholdingBoltTest {
+ "\"stateChangeReason\":\"Thresholds were exceeded for the sub-alarms: "
+ subAlarm.getExpression().getExpression() + " with the values: []\"," + "\"severity\":\"LOW\","
+ "\"subAlarms\":[" + buildSubAlarmJson(alarm.getSubAlarms()) + "],"
+ "\"timestamp\":1395587091}}";
+ "\"timestamp\":1395587091003}}";
verify(alarmEventForwarder, times(1)).send(alarmJson);
verify(alarmDAO, times(1)).updateState(alarmId, AlarmState.ALARM);
@ -150,7 +150,7 @@ public class AlarmThresholdingBoltTest {
+ subAlarms.get(2).getExpression().getExpression() + " with the values: []"
+ "\",\"severity\":\"LOW\","
+ "\"subAlarms\":[" + buildSubAlarmJson(alarm.getSubAlarms()) + "],"
+ "\"timestamp\":1395587091}}";
+ "\"timestamp\":1395587091003}}";
verify(alarmEventForwarder, times(1)).send(okJson);
verify(alarmDAO, times(1)).updateState(alarmId, AlarmState.OK);
}
@ -327,7 +327,7 @@ public class AlarmThresholdingBoltTest {
@Override
protected long getTimestamp() {
// Have to keep the time stamp constant so JSON comparison works
return 1395587091;
return 1395587091003l;
}
}
}