Exemplo n.º 1
0
        public override void Init(IServiceContainer serviceContainer, IDictionary <string, string> jobArgsDictionary)
        {
            base.Init(serviceContainer, jobArgsDictionary);

            _configuration = _serviceProvider.GetRequiredService <IOptionsSnapshot <RollUpDownloadFactsConfiguration> >().Value;

            _minAgeInDays = _configuration.MinAgeInDays ?? DefaultMinAgeInDays;
            Logger.LogInformation("Min age in days: {MinAgeInDays}", _minAgeInDays);
            _applicationInsightsHelper = new ApplicationInsightsHelper(ApplicationInsightsConfiguration.TelemetryConfiguration);
        }
        private void OnSqlConnectionInfoMessage(object sender, SqlInfoMessageEventArgs e)
        {
            if (string.IsNullOrEmpty(e.Message))
            {
                return;
            }

            Logger.LogInformation("SqlConnection info message: {Message}", e.Message);

            if (e.Message.StartsWith(_startTemplateRecordsDeletion) &&
                e.Message.EndsWith(_endTemplateFactDownloadDeletion))
            {
                var parts = e.Message
                            .Replace(_startTemplateRecordsDeletion, string.Empty)
                            .Replace(_endTemplateFactDownloadDeletion, string.Empty)
                            .Split(' ');

                var value = double.Parse(parts.Last());
                var packageDimensionId = parts.First().Replace(":", string.Empty);

                ApplicationInsightsHelper.TrackRollUpMetric("Download Facts Deleted", value, packageDimensionId);
            }
        }