internal static unsafe ServiceHealthState FromNative(NativeTypes.FABRIC_SERVICE_HEALTH_STATE nativeState)
        {
            var serviceHealthState = new ServiceHealthState();

            serviceHealthState.ServiceName           = NativeTypes.FromNativeUri(nativeState.ServiceName);
            serviceHealthState.AggregatedHealthState = (HealthState)nativeState.AggregatedHealthState;

            return(serviceHealthState);
        }
Exemple #2
0
        private static unsafe ApplicationHealth FromNative(NativeTypes.FABRIC_APPLICATION_HEALTH *nativeHealth)
        {
            var managedHealth = new ApplicationHealth();

            managedHealth.AggregatedHealthState           = (HealthState)nativeHealth->AggregatedHealthState;
            managedHealth.HealthEvents                    = HealthEvent.FromNativeList(nativeHealth->HealthEvents);
            managedHealth.ApplicationName                 = NativeTypes.FromNativeUri(nativeHealth->ApplicationName);
            managedHealth.ServiceHealthStates             = ServiceHealthState.FromNativeList(nativeHealth->ServiceHealthStates);
            managedHealth.DeployedApplicationHealthStates = DeployedApplicationHealthState.FromNativeList(nativeHealth->DeployedApplicationHealthStates);

            if (nativeHealth->Reserved != IntPtr.Zero)
            {
                var nativeHealthEx1 = (NativeTypes.FABRIC_APPLICATION_HEALTH_EX1 *)nativeHealth->Reserved;
                managedHealth.UnhealthyEvaluations = HealthEvaluation.FromNativeList(nativeHealthEx1->UnhealthyEvaluations);

                if (nativeHealthEx1->Reserved != IntPtr.Zero)
                {
                    var nativeHealthEx2 = (NativeTypes.FABRIC_APPLICATION_HEALTH_EX2 *)nativeHealthEx1->Reserved;
                    managedHealth.HealthStatistics = HealthStatistics.CreateFromNative(nativeHealthEx2->HealthStatistics);
                }
            }

            return(managedHealth);
        }