protected override async Task OnEnumChildren(bool deep) { Services.Clear(); var services = await _fabricClient.QueryManager.GetServiceListAsync(_application.ApplicationName); foreach (var service in services) { var sfService = new SFService(_fabricClient, this, service); Services.Add(sfService); if (deep) { await sfService.EnumChildren(deep); } } LoadInformation = await _fabricClient.QueryManager.GetApplicationLoadInformationAsync(_application.ApplicationName.AbsolutePath); }
/// <summary> /// Reports metrics specificed for an application /// </summary> /// <param name="metric"></param> /// <returns>Indicator of success.</returns> internal async Task <bool> ReportApplicationMetricAsync(MetricCheck metric) { ServiceEventSource.Current.ServiceRequestStart(nameof(this.ReportServiceMetricAsync)); try { ApplicationLoadInformation loadInfo = await this.Client.QueryManager.GetApplicationLoadInformationAsync(metric.Application, this._timeout, this._token); foreach (ApplicationLoadMetricInformation item in loadInfo.ApplicationLoadMetricInformation) { if (metric.MetricNames.Contains(item.Name)) { //TODO: //await // this._telemetry.ReportMetricAsync(metric.Service, metric.Partition, item.Name, item.ApplicationLoad, this._token) // .ConfigureAwait(false); } } } catch (FabricElementNotFoundException) { return(false); } catch (TimeoutException ex) { ServiceEventSource.Current.ServiceMessage(this._service.Context, "Timeout in ReportServiceMetric at {0}", ex.StackTrace); } catch (FabricObjectClosedException) { this._service.RefreshFabricClient(); ServiceEventSource.Current.ServiceMessage(this._service.Context, "FabricClient closed"); } ServiceEventSource.Current.ServiceRequestStop(nameof(this.ReportServiceMetricAsync)); return(true); }