private Action CreateReportingAction(AppPoolElement config, out AppPoolListener listener) { var element = new AppPoolListener(config.AppPoolName); listener = element; IMonitoringChannel channel = this.factory.CreateChannel(config.Type, config.Target); this.appPools.Add(element); return () => { if (config.WorkingSet) { int? value = element.ReportWorkingSet(); if (value.HasValue) { channel.Report(config.Key, value.Value); } } }; }
private Action CreateReportingAction(AppPoolElement config, out AppPoolListener listener) { AppPoolListener element = null; if (config.WorkingSet && string.IsNullOrEmpty(config.Counter)) { element = new AppPoolListener(config.AppPoolName, "Process", "Working Set"); } else if (!string.IsNullOrEmpty(config.Counter)) { element = new AppPoolListener(config.AppPoolName, config.Category, config.Counter); } listener = element; IMonitoringChannel channel = this.factory.CreateChannel(config.Type, config.Target); this.appPools.Add(element); return () => { if (element != null) { float? value = element.ReportValue(); if (value.HasValue) { channel.Report(config.Key, (long)value.Value); } } }; }