/// <summary> /// This is a function for analyzing one layer for root cause. We rank dimensions according to their likelihood of containing the root case. /// For each dimension, we select one dimension with values who contributes the most to the anomaly. /// </summary> private List <RootCause> AnalyzeOneLayer(RootCauseLocalizationInput src) { DimensionInfo dimensionInfo = SeparateDimension(src.AnomalyDimension, src.AggregateSymbol); Tuple <PointTree, PointTree, Dictionary <Dictionary <string, object>, TimeSeriesPoint> > pointInfo = GetPointsInfo(src, dimensionInfo); PointTree pointTree = pointInfo.Item1; PointTree anomalyTree = pointInfo.Item2; Dictionary <Dictionary <string, Object>, TimeSeriesPoint> dimPointMapping = pointInfo.Item3; //which means there is no anomaly point with the anomaly dimension or no point under anomaly dimension if (anomalyTree.ParentNode == null || dimPointMapping.Count == 0) { _preparedCauses.Add(new RootCause() { Items = new List <RootCauseItem>() }); return(_preparedCauses); } LocalizeRootCausesByDimension(anomalyTree, pointTree, src.AnomalyDimension, dimensionInfo.AggDims); foreach (var dst in _preparedCauses) { GetRootCauseDirectionAndScore(dimPointMapping, src.AnomalyDimension, dst, _beta, pointTree, src.AggregateType, src.AggregateSymbol); } return(_preparedCauses); }
public RootCauseAnalyzer(RootCauseLocalizationInput src, double beta, double rootCauseThreshold) { _src = src; _beta = beta; _rootCauseThreshold = rootCauseThreshold; _preparedCauses = new List <RootCause>(); }
/// <summary> /// This is a function for analyze one layer for root cause, we select one dimension with values who contributes the most to the anomaly. /// </summary> private RootCause AnalyzeOneLayer(RootCauseLocalizationInput src) { RootCause dst = new RootCause(); dst.Items = new List <RootCauseItem>(); DimensionInfo dimensionInfo = SeparateDimension(src.AnomalyDimension, src.AggregateSymbol); Tuple <PointTree, PointTree, Dictionary <string, TimeSeriesPoint> > pointInfo = GetPointsInfo(src, dimensionInfo); PointTree pointTree = pointInfo.Item1; PointTree anomalyTree = pointInfo.Item2; Dictionary <string, TimeSeriesPoint> dimPointMapping = pointInfo.Item3; //which means there is no anomaly point with the anomaly dimension or no point under anomaly dimension if (anomalyTree.ParentNode == null || dimPointMapping.Count == 0) { return(dst); } dst.Items.AddRange(LocalizeRootCauseByDimension(anomalyTree, pointTree, src.AnomalyDimension, dimensionInfo.AggDims)); GetRootCauseDirectionAndScore(dimPointMapping, src.AnomalyDimension, dst, _beta, pointTree, src.AggregateType, src.AggregateSymbol); return(dst); }
private Tuple <PointTree, PointTree, Dictionary <Dictionary <string, object>, TimeSeriesPoint> > GetPointsInfo(RootCauseLocalizationInput src, DimensionInfo dimensionInfo) { PointTree pointTree = new PointTree(); PointTree anomalyTree = new PointTree(); DimensionComparer dc = new DimensionComparer(); Dictionary <Dictionary <string, object>, TimeSeriesPoint> dimPointMapping = new Dictionary <Dictionary <string, object>, TimeSeriesPoint>(dc); List <TimeSeriesPoint> totalPoints = GetTotalPointsForAnomalyTimestamp(src); Dictionary <string, Object> subDim = GetSubDim(src.AnomalyDimension, dimensionInfo.DetailDims); foreach (TimeSeriesPoint point in totalPoints) { if (ContainsAll(point.Dimension, subDim)) { if (!dimPointMapping.ContainsKey(point.Dimension)) { dimPointMapping.Add(point.Dimension, point); bool isValidPoint = point.IsAnomaly == true; if (ContainsAll(point.Dimension, subDim)) { BuildTree(pointTree, dimensionInfo.AggDims, point, src.AggregateSymbol); if (isValidPoint) { BuildTree(anomalyTree, dimensionInfo.AggDims, point, src.AggregateSymbol); } } } } } return(new Tuple <PointTree, PointTree, Dictionary <Dictionary <string, Object>, TimeSeriesPoint> >(pointTree, anomalyTree, dimPointMapping)); }
protected List <TimeSeriesPoint> GetTotalPointsForAnomalyTimestamp(RootCauseLocalizationInput src) { MetricSlice slice = src.Slices.Single(slice => slice.TimeStamp.Equals(src.AnomalyTimestamp)); return(slice.Points); }
public RootCauseAnalyzer(RootCauseLocalizationInput src, double beta, double rootCauseThreshold) { _src = src; _beta = beta; _rootCauseThreshold = rootCauseThreshold; }
public RootCauseAnalyzer(RootCauseLocalizationInput src, double beta) { _src = src; _beta = beta; }
public RootCauseAnalyzer(RootCauseLocalizationInput src, double beta, double anomalyDeltaThreshold) { _src = src; _beta = beta; _anomalyDeltaThreshold = anomalyDeltaThreshold; }