public async Task <ClusterInfo> Info() { NodeList nodes = await this.query.GetNodesAsync(); ApplicationTypeList appTypes = await this.query.GetApplicationTypesAsync(); ApplicationList applications = await this.query.GetApplicationsAsync(); ClusterLoadInformation clusterLoadInfo = await this.query.GetClusterLoadAsync(); ClusterHealth clusterHealth = await this.query.GetClusterHealthAsync(); ProvisionedFabricCodeVersion version = await this.query.GetFabricVersion(); long serviceCount = 0; long partitionCount = 0; long replicaCount = 0; foreach (Node node in nodes) { DeployedApplicationList deployedApplicationList = await this.query.GetDeployedApplicationsAsync(node.NodeName); foreach (DeployedApplication deployedApplication in deployedApplicationList) { DeployedServiceReplicaList deployedReplicas = await this.query.GetDeployedReplicasAsync(node.NodeName, deployedApplication.ApplicationName); replicaCount += deployedReplicas.Count; } } foreach (Application application in applications) { ServiceList services = await this.query.GetServicesAsync(application.ApplicationName); serviceCount += services.Count; } return(new ClusterInfo( clusterHealth.AggregatedHealthState.ToString(), version != null ? version.CodeVersion : "not based", nodes.Select(x => x.NodeType).Distinct().Count(), appTypes.Count(), nodes.Select(x => x.FaultDomain.ToString()).Distinct().Count(), nodes.Select(x => x.UpgradeDomain).Distinct().Count(), nodes.Count, applications.Count, serviceCount, partitionCount, // TODO: partition count replicaCount, clusterLoadInfo.LastBalancingStartTimeUtc, clusterLoadInfo.LastBalancingEndTimeUtc)); }
public async Task <ClusterFilters> Filters() { NodeList nodes = await this.query.GetNodesAsync(); ApplicationTypeList appTypes = await this.query.GetApplicationTypesAsync(); return(new ClusterFilters( nodes.Select(x => x.NodeType).Distinct(), appTypes.Select(x => x.ApplicationTypeName), nodes.Select(x => x.FaultDomain.ToString()).Distinct(), nodes.Select(x => x.UpgradeDomain).Distinct())); }
public void Init() { // Application Type FABRIC_APPLICATION_TYPE_QUERY_RESULT_ITEM_ = this.random.CreateRandom <ApplicationType>(); FABRIC_APPLICATION_TYPE_QUERY_RESULT_ITEM_LIST_ = new ApplicationTypeList() { this.random.CreateRandom <ApplicationType>() }; FABRIC_APPLICATION_TYPE_QUERY_RESULT_ITEM_PAGED_LIST_ = new ApplicationTypePagedList(); FABRIC_APPLICATION_TYPE_QUERY_RESULT_ITEM_PAGED_LIST_.ContinuationToken = "ContinuationToken342741"; FABRIC_APPLICATION_TYPE_QUERY_RESULT_ITEM_PAGED_LIST_.Add(this.random.CreateRandom <ApplicationType>()); FABRIC_APPLICATION_TYPE_QUERY_RESULT_ITEM_PAGED_LIST_.Add(this.random.CreateRandom <ApplicationType>()); FABRIC_APPLICATION_TYPE_QUERY_RESULT_ITEM_PAGED_LIST_.Add(this.random.CreateRandom <ApplicationType>()); // Application FABRIC_APPLICATION_QUERY_RESULT_ITEM_ = this.random.CreateRandom <Application>(); FABRIC_APPLICATION_QUERY_RESULT_ITEM_LIST_ = new ApplicationList() { this.random.CreateRandom <Application>(), this.random.CreateRandom <Application>() }; // Service Type FABRIC_SERVICE_TYPE_DESCRIPTION_ = this.random.CreateRandom <ServiceTypeDescription>(); FABRIC_SERVICE_TYPE_QUERY_RESULT_ITEM_ = this.random.CreateRandom <ServiceType>(); FABRIC_SERVICE_TYPE_QUERY_RESULT_LIST_ = new ServiceTypeList() { this.random.CreateRandom <ServiceType>() }; //Replica FABRIC_SERVICE_REPLICA_QUERY_RESULT_ITEM_ = this.CreateReplica(); FABRIC_SERVICE_REPLICA_LIST_RESULT_ = new ServiceReplicaList(); FABRIC_SERVICE_REPLICA_LIST_RESULT_.ContinuationToken = "4387284"; FABRIC_SERVICE_REPLICA_LIST_RESULT_.Add(this.CreateReplica()); FABRIC_SERVICE_REPLICA_LIST_RESULT_.Add(this.CreateReplica()); // Partition FABRIC_SERVICE_PARTITION_INFORMATION_ = this.random.CreateRandom <ServicePartitionInformation>(); FABRIC_SERVICE_PARTITION_QUERY_RESULT_ITEM_ = CreatePartition(); FABRIC_SERVICE_PARTITION_LIST_RESULT_ = new ServicePartitionList(); FABRIC_SERVICE_PARTITION_LIST_RESULT_.ContinuationToken = Guid.NewGuid().ToString(); FABRIC_SERVICE_PARTITION_LIST_RESULT_.Add(this.CreatePartition()); FABRIC_SERVICE_PARTITION_LIST_RESULT_.Add(this.CreatePartition()); //Service FABRIC_SERVICE_QUERY_RESULT_ITEM_ = this.CreateServiceQueryItem(); FABRIC_SERVICE_QUERY_RESULT_LIST_ = new ServiceList() { this.CreateServiceQueryItem(), this.CreateServiceQueryItem() }; // Node FABRIC_NODE_DEACTIVATION_QUERY_RESULT_ITEM_ = this.random.CreateRandom <NodeDeactivationResult>(); FABRIC_NODE_DEACTIVATION_TASK_ = this.random.CreateRandom <NodeDeactivationTask>(); FABRIC_NODE_QUERY_RESULT_ITEM_ = this.random.CreateRandom <Node>(); // NodeList with continuation token FABRIC_NODE_LIST_QUERY_RESULT_ = new NodeList(); FABRIC_NODE_LIST_QUERY_RESULT_.ContinuationToken = "ContinuationToken34274"; FABRIC_NODE_LIST_QUERY_RESULT_.Add(this.random.CreateRandom <Node>()); FABRIC_NODE_LIST_QUERY_RESULT_.Add(this.random.CreateRandom <Node>()); FABRIC_NODE_LIST_QUERY_RESULT_.Add(this.random.CreateRandom <Node>()); // Deployed Application FABRIC_DEPLOYED_APPLICATION_QUERY_RESULT_ITEM_ = this.random.CreateRandom <DeployedApplication>(); FABRIC_DEPLOYED_APPLICATION_QUERY_RESULT_ITEM_LIST_ = new DeployedApplicationList() { FABRIC_DEPLOYED_APPLICATION_QUERY_RESULT_ITEM_ }; FABRIC_DEPLOYED_APPLICATION_QUERY_RESULT_ITEM_PAGED_LIST_ = new DeployedApplicationPagedList(); FABRIC_DEPLOYED_APPLICATION_QUERY_RESULT_ITEM_PAGED_LIST_.ContinuationToken = "ContinuationToken342741"; FABRIC_DEPLOYED_APPLICATION_QUERY_RESULT_ITEM_PAGED_LIST_.Add(this.random.CreateRandom <DeployedApplication>()); FABRIC_DEPLOYED_APPLICATION_QUERY_RESULT_ITEM_PAGED_LIST_.Add(this.random.CreateRandom <DeployedApplication>()); FABRIC_DEPLOYED_APPLICATION_QUERY_RESULT_ITEM_PAGED_LIST_.Add(this.random.CreateRandom <DeployedApplication>()); // Deployed Service FABRIC_DEPLOYED_SERVICE_REPLICA_QUERY_RESULT_ITEM_ = this.random.CreateRandom <DeployedStatefulServiceReplica>(); FABRIC_DEPLOYED_SERVICE_REPLICA_QUERY_RESULT_ITEM2_ = this.random.CreateRandom <DeployedStatelessServiceInstance>(); FABRIC_DEPLOYED_SERVICE_REPLICA_QUERY_RESULT_ITEM3_ = this.random.CreateRandom <DeployedServiceReplica>(); FABRIC_DEPLOYED_SERVICE_REPLICA_DETAIL_QUERY_RESULT_ITEM_ = this.random.CreateRandom <DeployedStatefulServiceReplicaDetail>(); FABRIC_DEPLOYED_SERVICE_REPLICA_DETAIL_QUERY_RESULT_ITEM2_ = this.random.CreateRandom <DeployedStatelessServiceInstanceDetail>(); // Code Package FABRIC_CODE_PACKAGE_ENTRY_POINT_STATISTICS_ = this.random.CreateRandom <CodePackageEntryPointStatistics>(); FABRIC_CODE_PACKAGE_ENTRY_POINT_ = this.random.CreateRandom <CodePackageEntryPoint>(); FABRIC_DEPLOYED_CODE_PACKAGE_QUERY_RESULT_ITEM_ = this.random.CreateRandom <DeployedCodePackage>(); FABRIC_DEPLOYED_CODE_PACKAGE_QUERY_RESULT_ITEM_LIST_ = new DeployedCodePackageList() { FABRIC_DEPLOYED_CODE_PACKAGE_QUERY_RESULT_ITEM_ }; FABRIC_DEPLOYED_SERVICE_PACKAGE_QUERY_RESULT_ITEM_ = this.random.CreateRandom <DeployedServicePackage>(); // Replicator FABRIC_PRIMARY_REPLICATOR_STATUS_QUERY_RESULT_ = this.random.CreateRandom <PrimaryReplicatorStatus>(); FABRIC_SECONDARY_REPLICATOR_STATUS_QUERY_RESULT_ = this.random.CreateRandom <SecondaryReplicatorStatus>(); // Load FABRIC_LOAD_METRIC_INFORMATION_ = this.random.CreateRandom <LoadMetricInformation>(); FABRIC_LOAD_METRIC_REPORT_ = this.random.CreateRandom <LoadMetricReport>(); FABRIC_NODE_LOAD_METRIC_INFORMATION_ = this.random.CreateRandom <NodeLoadMetricInformation>(); FABRIC_NODE_LOAD_INFORMATION_ = this.random.CreateRandom <NodeLoadInformation>(); FABRIC_PARTITION_LOAD_INFORMATION_ = this.random.CreateRandom <PartitionLoadInformation>(); FABRIC_REPLICA_LOAD_INFORMATION_ = this.random.CreateRandom <ReplicaLoadInformation>(); // Service Group FABRIC_SERVICE_GROUP_TYPE_MEMBER_DESCRIPTION_ = this.random.CreateRandom <ServiceGroupTypeMemberDescription>(); FABRIC_SERVICE_GROUP_MEMBER_TYPE_QUERY_RESULT_ITEM_ = this.random.CreateRandom <ServiceGroupMemberType>(); }