| 
														
															@@ -30,7 +30,7 @@ public class ThresholdModelContainer { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     private double position; 
														 | 
														
														 | 
														
															     private double position; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															     public static Map<String,ThresholdPredictModel> modelMap=new HashMap<>(); 
														 | 
														
														 | 
														
															     public static Map<String,ThresholdPredictModel> modelMap=new HashMap<>(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    public static MergingDigest mergingDigest = new MergingDigest(1000); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    public static Map<Integer,MergingDigest> mergingDigestMap=new HashMap<>(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															     private static final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); 
														 | 
														
														 | 
														
															     private static final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     @PostConstruct 
														 | 
														
														 | 
														
															     @PostConstruct 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -39,7 +39,11 @@ public class ThresholdModelContainer { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         beanMap.forEach((s,model)->{ 
														 | 
														
														 | 
														
															         beanMap.forEach((s,model)->{ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             modelMap.put(model.getName(), model); 
														 | 
														
														 | 
														
															             modelMap.put(model.getName(), model); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         }); 
														 | 
														
														 | 
														
															         }); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        mergingDigest.add(0); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        //只关注重点app 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        mergingDigestMap.put(0, new MergingDigest(10000)); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        mergingDigestMap.put(4, new MergingDigest(10000)); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        mergingDigestMap.put(5, new MergingDigest(10000)); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        mergingDigestMap.put(21, new MergingDigest(10000)); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         final Runnable task = new Runnable() { 
														 | 
														
														 | 
														
															         final Runnable task = new Runnable() { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             public void run() { 
														 | 
														
														 | 
														
															             public void run() { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 try { 
														 | 
														
														 | 
														
															                 try { 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -60,17 +64,21 @@ public class ThresholdModelContainer { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         return modelMap.get("basic"); 
														 | 
														
														 | 
														
															         return modelMap.get("basic"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    public static void mergingDigestAddScore(Double score){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        mergingDigest.add(score); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    public static void mergingDigestAddScore(Integer appType,Double score){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        mergingDigestMap.getOrDefault(appType,new MergingDigest(1)).add(score); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    public static double getThresholdByTDigest(Double sortPosition){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        return mergingDigest.quantile(sortPosition); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    public static double getThresholdByTDigest(Integer appType,Double sortPosition){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        return  mergingDigestMap.getOrDefault(appType,new MergingDigest(1)).quantile(sortPosition); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															     public void printDigestThreshold(){ 
														 | 
														
														 | 
														
															     public void printDigestThreshold(){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         try { 
														 | 
														
														 | 
														
															         try { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            log.info("svc=printDigestThreshold modelName=modelV2 mergingDigestThreshold={}", ThresholdModelContainer.getThresholdByTDigest(position)); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            for(Map.Entry<Integer,MergingDigest> entry:mergingDigestMap.entrySet()){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                log.info("svc=printDigestThreshold modelName=modelV2 appType={} mergingDigestThreshold={}" 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                        , entry.getKey(),entry.getValue().quantile(position)); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         }catch (Exception e){ 
														 | 
														
														 | 
														
															         }catch (Exception e){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             e.printStackTrace(); 
														 | 
														
														 | 
														
															             e.printStackTrace(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 |