Github user aledsage commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/887#discussion_r150017538
  
    --- Diff: 
core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/dto/BasicEntityMemento.java
 ---
    @@ -163,8 +165,27 @@ protected BasicEntityMemento(Builder builder) {
             if (configByKey != null) {
                 for (Map.Entry<ConfigKey<?>, Object> entry : 
configByKey.entrySet()) {
                     ConfigKey<?> key = entry.getKey();
    -                if (!configKeys.containsKey(key.getName()) && key != 
staticConfigKeys.get(key.getName())) {
    -                    configKeys.put(key.getName(), key);
    +                ConfigKey<?> staticKey = 
staticConfigKeys.get(key.getName());
    +                if (!configKeys.containsKey(key.getName()) && key != 
staticKey) {
    +                    // user added a key (programmatically) not declared on 
the type; persist if not anonymous.
    +                    // on rebind this shows up in getEntityType() which is 
still a difference in the pre-rebind entity,
    +                    // but that's more understandable and has been the 
case for a long time. 
    +                    // (the entity type is unclear in the yaml era anyway.)
    +                    // see RebindEntityTest.test*Key*
    +                    if (isAnonymous(key)) {
    +                        // 2017-11 no longer persist these, wasteful and 
unhelpful, 
    +                        // (can hurt if someone expects declared key to be 
meaningful) 
    +                        log.debug("Skipping persistence of "+key+" on 
"+getId()+" because it is anonymous");
    --- End diff --
    
    I'm torn whether this should be `trace` instead - we create a 
`BasicEntityMemento` a lot. This could fill the log with 1000s of such log 
messages per minute if we have a lot of entities and their sensor values change 
regularly due to polling for performance metrics etc.
    
    I'd either change it to trace, or guard it to only log once per type+key 
pair, or some such.


---

Reply via email to