zhyyu opened a new issue #7169:
URL: https://github.com/apache/skywalking/issues/7169


   Please answer these questions before submitting your issue.
   
   - Why do you submit this issue?
   - [x] Question or discussion
   - [ ] Bug
   - [ ] Requirement
   - [ ] Feature or performance improvement
   
   ___
   ### Question
   - What do you want to know?
   I use dynamic configuration(nacos)  to management alarm config, and **not 
intent** to manage slowDBAccessThreshold. So I do not config the 
agent-analyzer.default.slowDBAccessThreshold. But it worked weird, the default 
threshold will be changed to 10000, I read the code and found that if not 
config slowDBAccessThreshold in nacos, the code will rewrite the default 
threshold to 10000 because of triggering of DELETE notify. And this will 
confuse the user, where the 10000 comes from.
   
   ```java
   DBLatencyThresholdsAndWatcher
   
   private void activeSetting(String config) {
           Map<String, Integer> newThresholds = new HashMap<>();
           String[] settings = config.split(",");
           for (String setting : settings) {
               String[] typeValue = setting.split(":");
               if (typeValue.length == 2) {
                   newThresholds.put(typeValue[0].trim().toLowerCase(), 
Integer.parseInt(typeValue[1].trim()));
               }
           }
           if (!newThresholds.containsKey("default")) {
               newThresholds.put("default", 10000);
           }
   
           thresholds.set(newThresholds);
           settingsString.set(config);
       }
   
   public void notify(ConfigChangeEvent value) {
           if (EventType.DELETE.equals(value.getEventType())) {
               activeSetting("");
           } else {
               activeSetting(value.getNewValue());
           }
       }
   ```
   
   ___
   ### Requirement or improvement
   - Please describe your requirements or improvement suggestions.
   Can I send an pull request to change the "DELETE" notify behavior?
   
   from
   ```java
   private void activeSetting(String config) {
          // ...
           if (!newThresholds.containsKey("default")) {
               newThresholds.put("default", 10000);
           }
   
          // ...
       }
   
   ```
   
   to (the default setting in application.yml)
   
   ```java
   private void activeSetting(String config) {
          // ...
           if (!newThresholds.containsKey("default")) {
               newThresholds.put("default", 200);
               newThresholds.put("mongodb", 50);
           }
   
          // ...
       }
   
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to