override public IceMX.MetricsFailures[] getMapMetricsFailures(string viewName, string mapName, Ice.Current c) { lock (this) { MetricsViewI view = getMetricsView(viewName); if (view != null) { return(view.getFailures(mapName)); } return(new IceMX.MetricsFailures[0]); } }
public override IceMX.MetricsFailures getMetricsFailures(string viewName, string mapName, string id, Ice.Current c) { lock (this) { MetricsViewI view = getMetricsView(viewName); if (view != null) { return(view.getFailures(mapName, id)); } return(new IceMX.MetricsFailures()); } }
public override Dictionary <string, IceMX.Metrics[]> getMetricsView(string viewName, out long timestamp, Ice.Current current) { lock (this) { MetricsViewI view = getMetricsView(viewName); timestamp = Time.currentMonotonicTimeMillis(); if (view != null) { return(view.getMetrics()); } return(new Dictionary <string, IceMX.Metrics[]>()); } }
public void updateViews() { HashSet <IMetricsMapFactory> updatedMaps = new HashSet <IMetricsMapFactory>(); lock (this) { string viewsPrefix = "IceMX.Metrics."; Dictionary <string, string> viewsProps = _properties.getPropertiesForPrefix(viewsPrefix); Dictionary <string, MetricsViewI> views = new Dictionary <string, MetricsViewI>(); _disabledViews.Clear(); foreach (KeyValuePair <string, string> e in viewsProps) { string viewName = e.Key.Substring(viewsPrefix.Length); int dotPos = viewName.IndexOf('.'); if (dotPos > 0) { viewName = viewName.Substring(0, dotPos); } if (views.ContainsKey(viewName) || _disabledViews.Contains(viewName)) { continue; // View already configured. } validateProperties(viewsPrefix + viewName + ".", _properties); if (_properties.getPropertyAsIntWithDefault(viewsPrefix + viewName + ".Disabled", 0) > 0) { _disabledViews.Add(viewName); continue; // The view is disabled } // // Create the view or update it. // MetricsViewI v; if (!_views.TryGetValue(viewName, out v)) { v = new MetricsViewI(viewName); } views[viewName] = v; foreach (KeyValuePair <string, IMetricsMapFactory> f in _factories) { if (v.addOrUpdateMap(_properties, f.Key, f.Value, _logger)) { updatedMaps.Add(f.Value); } } } Dictionary <string, MetricsViewI> tmp = _views; _views = views; views = tmp; // // Go through removed views to collect maps to update. // foreach (KeyValuePair <string, MetricsViewI> v in views) { if (!_views.ContainsKey(v.Key)) { foreach (string n in v.Value.getMaps()) { updatedMaps.Add(_factories[n]); } } } } // // Call the updaters to update the maps. // foreach (IMetricsMapFactory f in updatedMaps) { f.update(); } }