internal AnalyticsPageViewRequest(IAnalyticsClient analyticsClient, string page, string title) { m_analyticsClient = analyticsClient; m_page = page; m_title = title; m_customVariables = new CustomVariableBag(); }
internal AnalyticsPageViewRequest(IAnalyticsClient analyticsClient, string page, string title) { _analyticsClient = analyticsClient; _page = page; _title = title; _customVariables = new VariableBucket(); }
protected async override Task OnStartAsync(IAnalyticsClient client, DateTime now) { await base.OnStartAsync(client, now); _lastGeoLocationMsgSent = now + TimeSpan.Zero.WithRandomDeviation(3); _geoRoute = _geoRouteProvider.GetGeoRoute(); }
public Task <IAnalyticsResult <T> > AnalyticsQueryAsync <T>(string statement, AnalyticsOptions options = default) { if (options == default) { options = new AnalyticsOptions(); } var query = new AnalyticsRequest(statement); query.ClientContextId(options.ClientContextId); query.Pretty(options.Pretty); query.IncludeMetrics(options.IncludeMetrics); query.NamedParameters = options.NamedParameters; query.PositionalArguments = options.PositionalParameters; if (options.Timeout.HasValue) { query.Timeout(options.Timeout.Value); } query.Priority(options.Priority); query.Deferred(options.Deferred); query.ConfigureLifespan(30); //TODO: use configuration.AnalyticsTimeout if (_analyticsClient == null) { _analyticsClient = new AnalyticsClient(_configuration); } return(_analyticsClient.QueryAsync <T>(query, options.CancellationToken)); }
internal AnalyticsPageViewRequest(IAnalyticsClient analyticsClient, string page, string title) { m_analyticsClient = analyticsClient; m_page = page; m_title = title; m_customVariables = new CustomVariableBag(); }
internal AnalyticsPageViewRequest(IAnalyticsClient analyticsClient, string page, string title) { _analyticsClient = analyticsClient; _page = page; _title = title; _customVariables = new VariableBucket(); }
protected async override Task OnTickAsync(IAnalyticsClient client, DateTime now, TimeSpan timeAlive, TimeSpan sinceLastTick, long tickNo) { await base.OnTickAsync(client, now, timeAlive, sinceLastTick, tickNo); if (_geoOptions.GeoLocationMsgInterval > TimeSpan.Zero && now - _lastGeoLocationMsgSent >= _geoOptions.GeoLocationMsgInterval.WithRandomDeviation(1)) { var currentPosition = _geoRoute.GetPosition(timeAlive); if (currentPosition == null) { // We've reached the end of the route for the bot _endOfRoute = true; return; } var msg = new GeoLocation { GameSession = GameSession, Lat = currentPosition.Latitude, Lon = currentPosition.Longitude }; await client.SendMessageAsync(msg, now); _lastGeoLocationMsgSent = now; } }
public NetherBot(IAnalyticsClient client, IGamerTagProvider gamerTagProvider, IGameSessionProvider gameSessionProvider, NetherBotOptions options = null) { _client = client; _gamerTagProvider = gamerTagProvider; _gameSessionProvider = gameSessionProvider; _options = options ?? new NetherBotOptions(); }
public SendSampleMessageMenu(IAnalyticsClient client) { _client = client; Title = "Send Sample Message"; LoadMenuItems(); }
/// <summary> /// Shuts down the client. Application life cycle end is tracked. /// </summary> internal static void ShutDown() { if (client != null) client.ShutDown(); IDisposable disposable = client as IDisposable; if (disposable != null) disposable.Dispose(); client = null; }
public SimulateMovementMenu(IAnalyticsClient client) { _client = client; Title = "Nether Analytics Test Client - Simulate moving game client"; MenuItems.Add('1', new ConsoleMenuItem("Generate random walking routes to files", GenerateRoutes)); MenuItems.Add('2', new ConsoleMenuItem("Simulate walkers", SimulateWalkers)); }
public Server(IIOService ioService, IViewClient viewClient, IViewClient streamingViewClient, IQueryClient queryClient, IQueryClient streamingQueryClient, ISearchClient searchClient, IAnalyticsClient analyticsClient, INodeAdapter nodeAdapter, ClientConfiguration clientConfiguration, ITypeTranscoder transcoder, IBucketConfig bucketConfig) { if (ioService != null) { _ioService = ioService; _ioService.ConnectionPool.Owner = this; } _nodeAdapter = nodeAdapter; _clientConfiguration = clientConfiguration; _bucketConfiguration = clientConfiguration.BucketConfigs[bucketConfig.Name]; _timingEnabled = _clientConfiguration.EnableOperationTiming; _typeTranscoder = transcoder; _bucketConfig = bucketConfig; //services that this node is responsible for IsMgmtNode = _nodeAdapter.MgmtApi > 0; IsDataNode = _nodeAdapter.KeyValue > 0; IsQueryNode = _nodeAdapter.N1QL > 0; IsIndexNode = _nodeAdapter.IndexAdmin > 0; IsViewNode = _nodeAdapter.Views > 0; IsSearchNode = _nodeAdapter.IsSearchNode; IsAnalyticsNode = _nodeAdapter.IsAnalyticsNode; //View and query clients ViewClient = viewClient; _streamingViewClient = streamingViewClient; QueryClient = queryClient; SearchClient = searchClient; _streamingQueryClient = streamingQueryClient; AnalyticsClient = analyticsClient; CachedViewBaseUri = UrlUtil.GetViewBaseUri(_nodeAdapter, _bucketConfiguration); CachedQueryBaseUri = UrlUtil.GetN1QLBaseUri(_nodeAdapter, _bucketConfiguration); if (IsDataNode || IsQueryNode) { _lastIOErrorCheckedTime = DateTime.Now; //On initialization, data nodes are authenticated, so they can start in a down state. //If the node is down immediately start the timer, otherwise disable it. if (IsDataNode) { _isDown = _ioService.ConnectionPool.InitializationFailed; } Log.Info("Initialization {0} for node {1}", _isDown ? "failed" : "succeeded", EndPoint); //timer and node status _heartBeatTimer = new Timer(_heartBeatTimer_Elapsed, null, Timeout.Infinite, Timeout.Infinite); if (_isDown) { StartHeartbeatTimer(); } } }
public AnalyticsIndexManager(ILogger <AnalyticsIndexManager> logger, IAnalyticsClient client, IRedactor redactor, IServiceUriProvider serviceUriProvider, ICouchbaseHttpClientFactory httpClientFactory) { _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _client = client ?? throw new ArgumentNullException(nameof(client)); _redactor = redactor ?? throw new ArgumentNullException(nameof(redactor)); _serviceUriProvider = serviceUriProvider ?? throw new ArgumentNullException(nameof(serviceUriProvider)); _httpClientFactory = httpClientFactory ?? throw new ArgumentNullException(nameof(httpClientFactory)); }
/// <summary> /// Loads the data. /// </summary> /// <param name="fromDate">From date.</param> /// <param name="toDate">To date.</param> public void LoadData(DateTime fromDate, DateTime toDate) { this.TryExecute( () => { IAnalyticsClient client = this.factory.Create <IAnalyticsClient>(); this.View.SetPerformanceData(client.GetAllAppPerformances(fromDate, toDate)); }, null, true); }
/// <summary> /// Calls the server to immediately refresh the performance graphs /// </summary> public void SendGraphRefresh() { this.TryExecute( () => { IAnalyticsClient client = this.factory.Create <IAnalyticsClient>(); client.RequestPerformanceRefresh(); }, null, true); }
public MainMenu(IAnalyticsClient client) { _client = client; Title = "Nether Analytics Test Client - Main Menu"; MenuItems.Add('1', new ConsoleMenuItem("Send Typed Game Messages ...", () => { new SendTypedGameEventMenu(_client).Show(); })); MenuItems.Add('2', new ConsoleMenuItem("Send Custom Game Message", SendCustomGameEvent)); MenuItems.Add('3', new ConsoleMenuItem("Simulate moving game client ...", () => { new SimulateMovementMenu(_client).Show(); })); MenuItems.Add('4', new ConsoleMenuItem("USQL Script ...", () => new USQLJobMenu().Show())); MenuItems.Add('5', new ConsoleMenuItem("Results API Consumer ...", () => { new ResultsApiConsumerMenu().Show(); })); MenuItems.Add('6', new ConsoleMenuItem("Scheduler ...", () => { new SchedulerJobMenu().Show(); })); }
/// <summary> /// Shuts down the client. Application life cycle end is tracked. /// </summary> internal static void ShutDown() { if (client != null) { client.ShutDown(); } IDisposable disposable = client as IDisposable; if (disposable != null) { disposable.Dispose(); } client = null; }
protected async virtual Task OnTickAsync(IAnalyticsClient client, DateTime now, TimeSpan timeAlive, TimeSpan sinceLastTick, long tickNo) { if (_options.HeartBeatMessageInterval > TimeSpan.Zero && now - _lastHeartBeatMsgSent >= _options.HeartBeatMessageInterval.WithRandomDeviation()) { // Send HeartBeat msg if enough time has passed since var msg = new HeartBeat { GameSession = GameSession }; await client.SendMessageAsync(msg, now); _lastHeartBeatMsgSent = now; } }
protected async virtual Task OnStartAsync(IAnalyticsClient client, DateTime now) { _lastHeartBeatMsgSent = now + TimeSpan.Zero.WithRandomDeviation(3); if (_options.SessionStartMessage) { var msg = new SessionStart { GamerTag = GamerTag, GameSession = GameSession }; await client.SendMessageAsync(msg, now); } }
public AnalyticsAgent(RecognitionTaskQueue queue, IAnalyticsClient analyticsClient, ILoggerFactory loggerFactory, IPhotoRepository photoRepository, IRecognitionResultsRepository recognitionRepository, IConfiguration configuration) { this.queue = queue; this.analyticsClient = analyticsClient; this.photoRepository = photoRepository; this.configuration = configuration; this.recognitionRepository = recognitionRepository; logger = loggerFactory.CreateLogger <AnalyticsAgent>(); PollingTask(); }
public Server(IIOService ioService, IViewClient viewClient, IViewClient streamingViewClient, IQueryClient queryClient, IQueryClient streamingQueryClient, ISearchClient searchClient, IAnalyticsClient analyticsClient, INodeAdapter nodeAdapter, ITypeTranscoder transcoder, ConfigContextBase context) { if (ioService != null) { _ioService = ioService; _ioService.ConnectionPool.Owner = this; } _clientConfiguration = context.ClientConfig; _bucketConfiguration = context.ClientConfig.BucketConfigs[context.BucketConfig.Name]; _timingEnabled = _clientConfiguration.EnableOperationTiming; _typeTranscoder = transcoder; _bucketConfig = context.BucketConfig; //set all properties based off the nodes and nodeExt adapter LoadNodeAdapter(nodeAdapter); //View and query clients ViewClient = viewClient; _streamingViewClient = streamingViewClient; QueryClient = queryClient; SearchClient = searchClient; _streamingQueryClient = streamingQueryClient; AnalyticsClient = analyticsClient; if (IsDataNode || IsQueryNode) { _lastIOErrorCheckedTime = DateTime.Now; //On initialization, data nodes are authenticated, so they can start in a down state. //If the node is down immediately start the timer, otherwise disable it. if (IsDataNode) { _isDown = _ioService.ConnectionPool.InitializationFailed; } Log.Info("Initialization {0} for node {1}", _isDown ? "failed" : "succeeded", EndPoint); //timer and node status _heartBeatTimer = new Timer(_heartBeatTimer_Elapsed, null, Timeout.Infinite, Timeout.Infinite); if (_isDown) { StartHeartbeatTimer(); } } }
public SendTypedGameEventMenu(IAnalyticsClient client) { _client = client; Title = "Nether Analytics Test Client - Send Static Game Messages"; var msgTypes = GetMessageTypes(); var menuKey = 'a'; foreach (var msgType in msgTypes) { var msg = (ITypeVersionMessage)Activator.CreateInstance(msgType); MenuItems.Add(menuKey++, new ConsoleMenuItem( $"{msg.Type}, {msg.Version}", () => TypedMessageSelected(msg))); } MenuItems.Add('1', new ConsoleMenuItem("Loop and send random messages", LoopAndSendRandom)); }
/// <summary> /// Loads the data. /// </summary> /// <param name="fromDate">From date.</param> /// <param name="toDate">To date.</param> public void LoadData(DateTime fromDate, DateTime toDate) { this.TryExecute( () => { IAnalyticsClient client = this.factory.Create <IAnalyticsClient>(); this.View.SetCpuPerformanceData(client.GetSystemCpuPerformance(fromDate, toDate)); }, null, true); this.TryExecute( () => { IAnalyticsClient client = this.factory.Create <IAnalyticsClient>(); this.View.SetMemoryPerformanceData(client.GetSystemMemoryPerformance(fromDate, toDate)); }, null, true); }
public static void Init(IAnalyticsClient client, DynamoModel model) { Analytics.Start(client); }
/// <summary> /// Starts the client when DynamoModel is created. This method initializes /// the Analytics service and application life cycle start is tracked. /// </summary> /// <param name="model">DynamoModel</param> internal static void Start(DynamoModel model) { client = new DynamoAnalyticsClient(); client.Start(model); model.WorkspaceAdded += OnWorkspaceAdded; }
/// <summary> /// Starts analytics client /// </summary> /// <param name="client"></param> internal static void Start(IAnalyticsClient client) { Analytics.client = client; client.Start(); }
/// <summary> /// Starts analytics client /// </summary> /// <param name="client"></param> internal static void Start(IAnalyticsClient client) { Analytics.client = client; client.Start(); }
public GeoBot(IAnalyticsClient client, IGamerTagProvider gamerTagProvider, IGameSessionProvider gameSessionProvider, IGeoRouteProvider geoRouteProvider, NetherBotOptions options = null, GeoBotOptions geoOptions = null) : base(client, gamerTagProvider, gameSessionProvider, options) { _geoOptions = geoOptions ?? new GeoBotOptions(); _geoRouteProvider = geoRouteProvider; }
public static void Init(IAnalyticsClient client, DynamoModel model) { Analytics.client = client; client.Start(model); }
/// <summary> /// Starts the client when DynamoModel is created. This method initializes /// the Analytics service and application life cycle start is tracked. /// </summary> /// <param name="model">DynamoModel</param> internal static void Start(DynamoModel model) { client = new DynamoAnalyticsClient(); client.Start(model); model.WorkspaceAdded += OnWorkspaceAdded; }
internal static EndpointDiagnostics CreateEndpointHealth(string bucketName, DateTime createdAt, IAnalyticsClient client, EndPoint endPoint) { return(new EndpointDiagnostics { Type = ServiceType.Analytics, LastActivity = CalculateLastActivity(createdAt, client.LastActivity), Remote = endPoint?.ToString() ?? UnknownEndpointValue, State = client.LastActivity.HasValue ? ServiceState.Connected : ServiceState.New, Scope = bucketName }); }
protected virtual Task OnStopAsync(IAnalyticsClient client, DateTime now, TimeSpan timeAlive) { _gamerTagProvider.ReturnGamerTag(GamerTag); return(Task.CompletedTask); }