コード例 #1
0
        public IXEventsOnTarget CreateTarget(XEventsExportSettings settings, KeyValuePair<LogBufferItemKey, LogBufferItem> logBufferItem)
        {
            IXEventsOnTarget target = new ExtendedEventsOnClickHouse(settings.ConnectionString,
                logBufferItem.Key.Settings.Portion);
            target.SetLogInformation(logBufferItem.Key.Settings.XEventsLog);

            return target;
        }
コード例 #2
0
        public async Task Run(CancellationToken cancellationToken)
        {
            while (true)
            {
                if (cancellationToken.IsCancellationRequested)
                {
                    break;
                }

                using (IXEventExportMaster export =
                           new XEventExportMaster(BeforeExportData, AfterExportData, OnErrorExportData))
                {
                    export.SetXEventsPath(_settings.XEventsPath);
                    IXEventsOnTarget target =
                        new ExtendedEventsOnClickHouse(_settings.ConnectionString, _settings.Portion);
                    export.SetTarget(target);
                    await export.StartSendEventsToStorage(cancellationToken);
                }

                if (_settings.UseWatchMode)
                {
                    if (cancellationToken.IsCancellationRequested)
                    {
                        break;
                    }
                    await Task.Delay(_settings.DelayMs, cancellationToken);
                }
                else
                {
                    break;
                }

                if (cancellationToken.IsCancellationRequested)
                {
                    break;
                }
            }
        }