Github user nickwallen commented on a diff in the pull request:
https://github.com/apache/metron/pull/977#discussion_r178599674
--- Diff:
metron-analytics/metron-profiler-common/src/main/java/org/apache/metron/profiler/DefaultMessageDistributor.java
---
@@ -281,29 +289,45 @@ public DefaultMessageDistributor
withPeriodDuration(int duration, TimeUnit units
/**
* A listener that is notified when profiles expire from the active
cache.
*/
- private class ActiveCacheRemovalListener implements
RemovalListener<String, ProfileBuilder> {
+ private class ActiveCacheRemovalListener implements
RemovalListener<Integer, ProfileBuilder> {
@Override
- public void onRemoval(RemovalNotification<String, ProfileBuilder>
notification) {
+ public void onRemoval(RemovalNotification<Integer, ProfileBuilder>
notification) {
- String key = notification.getKey();
ProfileBuilder expired = notification.getValue();
+ LOG.warn("Profile expired from active cache; profile={}, entity={}",
+ expired.getDefinition().getProfile(),
+ expired.getEntity());
- LOG.warn("Profile expired from active cache; key={}", key);
- expiredCache.put(key, expired);
+ // add the profile to the expired cache
+ expiredCache.put(notification.getKey(), expired);
}
}
/**
* A listener that is notified when profiles expire from the active
cache.
*/
- private class ExpiredCacheRemovalListener implements
RemovalListener<String, ProfileBuilder> {
+ private class ExpiredCacheRemovalListener implements
RemovalListener<Integer, ProfileBuilder> {
@Override
- public void onRemoval(RemovalNotification<String, ProfileBuilder>
notification) {
+ public void onRemoval(RemovalNotification<Integer, ProfileBuilder>
notification) {
+
+ if(notification.wasEvicted()) {
+
+ // the expired profile was NOT flushed in time
--- End diff --
A profile being removed from the expired cache is only 'bad' when it is
evicted. When an eviction occurs, we get a WARN. Otherwise, only a DEBUG is
used. This makes the logging much more useful when troubleshooting.
---