Beispiel #1
0
        public ProbeResult Execute <T>(T snapshot)
        {
            ConnectionSnapshot data = snapshot as ConnectionSnapshot;
            ProbeResult        result;

            var probeData = new List <ProbeData>
            {
                new ProbeDataImpl("Channels.Count", data.Channels.Count.ToString()),
                new ProbeDataImpl("OpenChannelLimit", data.OpenChannelsLimit.ToString())
            };

            if (Convert.ToUInt64(data.Channels.Count) >= data.OpenChannelsLimit)
            {
                _kb.TryGet(Metadata.Id, ProbeResultStatus.Unhealthy, out var article);
                result = new UnhealthyProbeResult(data.NodeIdentifier,
                                                  data.Identifier,
                                                  Metadata.Id,
                                                  Metadata.Name,
                                                  ComponentType,
                                                  probeData,
                                                  article);
            }
            else
            {
                _kb.TryGet(Metadata.Id, ProbeResultStatus.Healthy, out var article);
                result = new HealthyProbeResult(data.NodeIdentifier,
                                                data.Identifier,
                                                Metadata.Id,
                                                Metadata.Name,
                                                ComponentType,
                                                probeData, article);
            }

            NotifyObservers(result);

            return(result);
        }
Beispiel #2
0
        public ProbeResult Execute <T>(T snapshot)
        {
            ProbeResult        result;
            ConnectionSnapshot data = snapshot as ConnectionSnapshot;

            var probeData = new List <ProbeData>
            {
                new ProbeDataImpl("State", data.State.ToString())
            };

            if (data.State == BrokerConnectionState.Blocked)
            {
                _kb.TryGet(Metadata.Id, ProbeResultStatus.Unhealthy, out var article);
                result = new UnhealthyProbeResult(data.NodeIdentifier,
                                                  data.Identifier,
                                                  Metadata.Id,
                                                  Metadata.Name,
                                                  ComponentType,
                                                  probeData,
                                                  article);
            }
            else
            {
                _kb.TryGet(Metadata.Id, ProbeResultStatus.Healthy, out var article);
                result = new HealthyProbeResult(data.NodeIdentifier,
                                                data.Identifier,
                                                Metadata.Id,
                                                Metadata.Name,
                                                ComponentType,
                                                probeData,
                                                article);
            }

            NotifyObservers(result);

            return(result);
        }