public void AllSpecified()
            {
                const string companyName    = "Test Co. Inc. LLC.";
                const string productName    = "Whirligoogle";
                const string productVersion = "v1.2.3";
                const string osName         = "TestOs";
                var          agentId        = new AgentIdentifier(companyName, productName, productVersion, osName);

                agentId.ToString().Should().Be(string.Format("{0}-{1}/{2} [{3} | {4}]",
                                                             companyName,
                                                             productName,
                                                             productVersion,
                                                             osName,
                                                             _osVersionString));
            }
Beispiel #2
0
        /// <summary>
        /// Creates an IRequestVisitor<IResponse> (i.e. the "request execution engine") using the default
        /// implementation for each of the requisite visitors.  Unless a 3rd-party client wants to override
        /// a particular visitor (in order to modify the way that the SDK creates and interperates calls
        /// to the LevelUp api) for some reason, these defaults are what should be used in the creation of
        /// the LevelUpClient implementation class.
        /// </summary>
        private static IRequestVisitor <IResponse> GetDefaultLevelUpRequestEngine(AgentIdentifier identifier,
                                                                                  LevelUpEnvironment enviornment, IRestfulService httpRestService)
        {
            IRequestVisitor <string> endpointCreator = new RequestEndpointCreator(enviornment);

            IRequestVisitor <string> headerAuthorizationTokenCreator = new RequestHeaderTokenCreator();

            IRequestVisitor <Dictionary <HttpStatusCode, LevelUpRestWrapper.ResponseAction> > customHttpStatusCodeHandlers
                = new AdditionalHttpStatusCodeHandlers();

            IRequestVisitor <IResponse> requestExecutionEngine = new RequestExecutionEngine(httpRestService, identifier,
                                                                                            endpointCreator, headerAuthorizationTokenCreator, customHttpStatusCodeHandlers);

            return(requestExecutionEngine);
        }
Beispiel #3
0
        private Agent Create(AgentIdentifier identifier)
        {
            if (identifier == AgentIdentifier.PrimaryMoveAnalysisAgent)
            {
                return(new PrimaryMoveAnalysisAgent(
                           this.configuration,
                           this.taskRunner,
                           this.logProvider.CreateLoggerInstance(AgentIdentifier.PrimaryMoveAnalysisAgent.ToString()),
                           this.storeProvider,
                           this.storeConnection.EventStoreReader,
                           this.storeConnection.QueryStoreReader,
                           this.clusterQuery,
                           this.token));
            }

            throw new NotSupportedException(string.Format("Idenfier: {0}", identifier));
        }
Beispiel #4
0
        public AnalysisContainer(FabricAnalysisEvent analysisEvent, AgentIdentifier agentIdentifier, int maxAnalysisAttempts = DefaultAnalysisAttempts)
        {
            if (maxAnalysisAttempts <= 0 || maxAnalysisAttempts > MaxAnalysisAttempts)
            {
                throw new ArgumentOutOfRangeException(
                          "maxAnalysisAttempts",
                          string.Format(CultureInfo.InvariantCulture, "Maximum Analysis attempt count is : '{0}'", MaxAnalysisAttempts));
            }

            Assert.IsNotNull(analysisEvent, "analysisEvent != null");
            this.AnalysisEvent      = analysisEvent;
            this.maxAttempts        = maxAnalysisAttempts;
            this.analysisOutput     = new StringBuilder();
            this.rootCauseContainer = new RootCauseContainer();
            this.fixContainer       = new FixContainer();
            this.relevantTraces     = new List <TraceRecord>();
            this.customContext      = new Dictionary <string, string>();
            this.Agent = agentIdentifier;
        }
        internal void AddConsumer(AgentIdentifier agentIdentifier, IAnalysisConsumer analysisConsumer, ConsumeOptions option)
        {
            Assert.IsNotNull(analysisConsumer, "analysisConsumer");
            if (this.consumerMap.ContainsKey(agentIdentifier))
            {
                var consumersForThisAgent = this.consumerMap[agentIdentifier];
                if (consumersForThisAgent.Contains(new KeyValuePair <IAnalysisConsumer, ConsumeOptions>(analysisConsumer, option)))
                {
                    throw new Exception(string.Format(CultureInfo.InvariantCulture, "Consumer: {0} with Option: {1} Already Present", analysisConsumer, option));
                }

                consumersForThisAgent[analysisConsumer] = option;
            }
            else
            {
                this.consumerMap[agentIdentifier] = new Dictionary <IAnalysisConsumer, ConsumeOptions> {
                    { analysisConsumer, option }
                };
            }
        }
Beispiel #6
0
 public AgentDescriptor(AgentIdentifier AgentId, Type HostType)
 {
     this.AgentId  = AgentId;
     this.HostType = HostType;
 }
Beispiel #7
0
 public AgentRuntimeStatus(AgentIdentifier AgentId, ServiceAgentState CurrentState, DateTime?AsOf = null)
 {
     this.AgentId      = AgentId;
     this.CurrentState = CurrentState;
     this.AsOf         = AsOf ?? now();
 }
Beispiel #8
0
        internal PartitionInsightGenerator(IInsightRuntime runtime, ICallbackStore callbackStore, CancellationToken token) : base(runtime, callbackStore, token)
        {
            Assert.IsNotNull(runtime, "runtime != null");

            this.primaryMoveAnalysisAgentIdentifier = AgentIdentifier.PrimaryMoveAnalysisAgent;
        }
            public void AllPropertiesNull()
            {
                var agentId = new AgentIdentifier(null, null, null, null);

                agentId.ToString().Should().Be("[" + _osVersionString + "]");
            }
Beispiel #10
0
 internal LevelUpClient(IRestfulService restService, AgentIdentifier identifier, LevelUpEnvironment targetEnviornment)
 {
     _restWrapper       = new LevelUpRestWrapper(restService, identifier);
     _targetEnviornment = targetEnviornment;
 }
 public static IAgentComputationResult <P> Create <P>(AgentIdentifier Agent,
                                                      P Payload, IAppMessage Message = null)
 => new AgentComputationResult <P>(Agent, Payload, Message ?? AppMessage.Empty);
 public AgentComputationResult(AgentIdentifier AgentIdentifier, object Payload, IAppMessage Description)
 {
     this.AgentIdentifier = AgentIdentifier;
     this.Payload         = Payload;
     this.Description     = Description;
 }
Beispiel #13
0
 public Agent GetOrCreateAgentInstance(AgentIdentifier identifier)
 {
     return(this.agentMap.GetOrAdd(identifier, this.Create));
 }
Beispiel #14
0
 public NodeAgentSettings(IConfigurationProvider configure, AgentIdentifier AgentId)
     : base(configure, AgentId)
 {
 }