fix slow db dynamic config bug (#7192)
This commit is contained in:
parent
a966eea35c
commit
b8fadec033
|
|
@ -46,6 +46,7 @@ Release Notes.
|
|||
* Fix CounterWindow increase computing issue.
|
||||
* Performance: optimize Envoy ALS analyzer performance in high traffic load scenario (reduce ~1cpu in ~10k RPS).
|
||||
* Performance: trim useless metadata fields in Envoy ALS metadata to improve performance.
|
||||
* Fix: slowDBAccessThreshold dynamic config error when not configured.
|
||||
|
||||
#### UI
|
||||
* Fix the date component for log conditions.
|
||||
|
|
|
|||
|
|
@ -23,17 +23,17 @@ import java.util.Map;
|
|||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import org.apache.skywalking.oap.server.analyzer.module.AnalyzerModule;
|
||||
import org.apache.skywalking.oap.server.configuration.api.ConfigChangeWatcher;
|
||||
import org.apache.skywalking.oap.server.core.Const;
|
||||
import org.apache.skywalking.oap.server.library.module.ModuleProvider;
|
||||
|
||||
public class DBLatencyThresholdsAndWatcher extends ConfigChangeWatcher {
|
||||
private AtomicReference<Map<String, Integer>> thresholds;
|
||||
private AtomicReference<String> settingsString;
|
||||
private final String initialSettingsString;
|
||||
private volatile String dynamicSettingsString;
|
||||
|
||||
public DBLatencyThresholdsAndWatcher(String config, ModuleProvider provider) {
|
||||
super(AnalyzerModule.NAME, provider, "slowDBAccessThreshold");
|
||||
thresholds = new AtomicReference<>(new HashMap<>());
|
||||
settingsString = new AtomicReference<>(Const.EMPTY_STRING);
|
||||
initialSettingsString = config;
|
||||
|
||||
activeSetting(config);
|
||||
}
|
||||
|
|
@ -47,12 +47,8 @@ public class DBLatencyThresholdsAndWatcher extends ConfigChangeWatcher {
|
|||
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 int getThreshold(String type) {
|
||||
|
|
@ -67,14 +63,16 @@ public class DBLatencyThresholdsAndWatcher extends ConfigChangeWatcher {
|
|||
@Override
|
||||
public void notify(ConfigChangeEvent value) {
|
||||
if (EventType.DELETE.equals(value.getEventType())) {
|
||||
activeSetting("");
|
||||
dynamicSettingsString = null;
|
||||
activeSetting(initialSettingsString);
|
||||
} else {
|
||||
dynamicSettingsString = value.getNewValue();
|
||||
activeSetting(value.getNewValue());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String value() {
|
||||
return settingsString.get();
|
||||
return dynamicSettingsString;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue