public CorrelationIdMiddleware(RequestDelegate next, ICorrelationIdProvider correlationIdProvider, ILogger <CorrelationIdMiddleware> logger) { _next = next; _correlationIdProvider = correlationIdProvider; _logger = logger; }
public InvoiceCreatedUpdatedDeletedEventHook( ICurrentUser currentUser, ICorrelationIdProvider correlationIdProvider) { _currentUser = currentUser; _correlationIdProvider = correlationIdProvider; }
public BudgetApiHeadersProvider( ICorrelationIdProvider correlationIdProvider, ISessionHelper sessionHelper) { this.correlationIdProvider = correlationIdProvider; this.sessionHelper = sessionHelper; }
public HttpClientService(SegmentClientOptions segmentClientOptions, HttpClient httpClient, ILogService logService, ICorrelationIdProvider correlationIdProvider) { this.segmentClientOptions = segmentClientOptions; this.httpClient = httpClient; this.logService = logService; this.correlationIdProvider = correlationIdProvider; }
/// <summary> /// Creates a new instance of the CorrelationIdMiddleware. /// </summary> /// <param name="next">The next middleware in the pipeline.</param> /// <param name="logger">The <see cref="ILogger"/> instance to log to.</param> /// <param name="options">The configuration options.</param> /// <param name="correlationIdProvider"></param> public CorrelationIdMiddleware(RequestDelegate next, ILogger <CorrelationIdMiddleware> logger, IOptions <CorrelationIdOptions> options, ICorrelationIdProvider correlationIdProvider = null) { _next = next ?? throw new ArgumentNullException(nameof(next)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _correlationIdProvider = correlationIdProvider; _options = options.Value ?? throw new ArgumentNullException(nameof(options)); }
public async Task Invoke(HttpContext context, ICorrelationIdProvider correlationIdProvider) { if (context == null) { throw new System.ArgumentNullException(nameof(context)); } try { var loggerState = new LoggerState { [correlationIdProvider.CorrelationIdKey] = correlationIdProvider.GetCorrelationId() //Add any number of properties to be logged under a single scope }; using (_logger.BeginScope(loggerState)) { await _next(context); } } //To make sure that we don't loose the scope in case of an unexpected error catch (Exception ex) when(LogOnUnexpectedError(ex)) { } }
public HttpClientService(JobProfileClientOptions jobProfileClientOptions, HttpClient httpClient, ILogService logger, ICorrelationIdProvider correlationIdProvider) { this.jobProfileClientOptions = jobProfileClientOptions; this.httpClient = httpClient; this.logger = logger; this.correlationIdProvider = correlationIdProvider; }
public DynamicHttpProxyInterceptor( IDynamicProxyHttpClientFactory httpClientFactory, IOptions <AbpHttpClientOptions> clientOptions, IOptionsSnapshot <AbpRemoteServiceOptions> remoteServiceOptions, IApiDescriptionFinder apiDescriptionFinder, IJsonSerializer jsonSerializer, IRemoteServiceHttpClientAuthenticator clientAuthenticator, ICancellationTokenProvider cancellationTokenProvider, ICorrelationIdProvider correlationIdProvider, IOptions <AbpCorrelationIdOptions> correlationIdOptions, ICurrentTenant currentTenant) { CancellationTokenProvider = cancellationTokenProvider; CorrelationIdProvider = correlationIdProvider; CurrentTenant = currentTenant; AbpCorrelationIdOptions = correlationIdOptions.Value; HttpClientFactory = httpClientFactory; ApiDescriptionFinder = apiDescriptionFinder; JsonSerializer = jsonSerializer; ClientAuthenticator = clientAuthenticator; ClientOptions = clientOptions.Value; AbpRemoteServiceOptions = remoteServiceOptions.Value; Logger = NullLogger <DynamicHttpProxyInterceptor <TService> > .Instance; }
public static IServiceScope CreateHttpScope(this IServiceProvider serviceProvider, HttpRequest request) { ICorrelationIdProvider correlationIdProvider = serviceProvider.GetService <ICorrelationIdProvider>(); string correlationId = request.GetCorrelationId(); correlationIdProvider.SetCorrelationId(correlationId); if (!request.HttpContext.Response.Headers.ContainsKey("sfa-correlationId")) { request.HttpContext.Response.Headers.Add("sfa-correlationId", correlationId); } string userId = "unknown"; string username = "******"; if (request.HttpContext.Request.Headers.ContainsKey("sfa-userid")) { userId = request.HttpContext.Request.Headers["sfa-userid"]; } if (request.HttpContext.Request.Headers.ContainsKey("sfa-username")) { username = request.HttpContext.Request.Headers["sfa-username"]; } request.HttpContext.User = new ClaimsPrincipal(new[] { new ClaimsIdentity(new [] { new Claim(ClaimTypes.Sid, userId), new Claim(ClaimTypes.Name, username) }) }); return(serviceProvider.CreateScope()); }
public ApiClientProxy(ApiOptions options, ILogger logger, ICorrelationIdProvider correlationIdProvider) { Guard.ArgumentNotNull(options, nameof(options)); Guard.IsNullOrWhiteSpace(options.ApiEndpoint, nameof(options.ApiEndpoint)); Guard.IsNullOrWhiteSpace(options.ApiKey, nameof(options.ApiKey)); Guard.ArgumentNotNull(logger, nameof(logger)); Guard.ArgumentNotNull(correlationIdProvider, nameof(correlationIdProvider)); _correlationIdProvider = correlationIdProvider; _httpClient = new HttpClient(new HttpClientHandler() { AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate }); string baseAddress = options.ApiEndpoint; if (!baseAddress.EndsWith("/", StringComparison.CurrentCulture)) { baseAddress = $"{baseAddress}/"; } _httpClient.BaseAddress = new Uri(baseAddress, UriKind.Absolute); _httpClient.DefaultRequestHeaders?.Add(OcpApimSubscriptionKey, options.ApiKey); _httpClient.DefaultRequestHeaders?.Add(SfaCorellationId, _correlationIdProvider.GetCorrelationId()); _httpClient.DefaultRequestHeaders?.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); _httpClient.DefaultRequestHeaders?.AcceptEncoding.Add(new StringWithQualityHeaderValue("gzip")); _httpClient.DefaultRequestHeaders?.AcceptEncoding.Add(new StringWithQualityHeaderValue("deflate")); _logger = logger; }
public CorrelateRequestMiddleware(RequestDelegate next, RequestCorrelationOptions correlationOptions, ICorrelationIdProvider correlationIdProvider) { _next = next; _correlationOptions = correlationOptions ?? throw new ArgumentNullException(nameof(correlationOptions)); _correlationIdProvider = correlationIdProvider ?? throw new ArgumentNullException(nameof(correlationIdProvider)); }
public FeatureFlagSettingsUpdatedDomainEventHook( ICurrentUser currentUser, ICorrelationIdProvider correlationIdProvider ) { _currentUser = currentUser; _correlationIdProvider = correlationIdProvider; }
public LegacyExceptionToActionResultMapper(IEnumerable <IExceptionToActionResultMapperHook> mapperHooks, IHttpContextAccessor httpContextAccessor, ICorrelationIdProvider correlationIdProvider, IHostingEnvironment hostingEnvironment, ILogger <LegacyExceptionToActionResultMapper> logger) { _mapperHooks = mapperHooks; _httpContextAccessor = httpContextAccessor; _correlationIdProvider = correlationIdProvider; _hostingEnvironment = hostingEnvironment; _logger = logger; }
/// <summary> /// Initializes a new instance of the <see cref="T:Weir.Synertrex.Common.Logging.CorrelationIdLogEnricher" /> class. /// </summary> /// <param name="correlationIdLookup">Correlation ID Lookup Provider</param> public CorrelationIdLogEnricher(ICorrelationIdProvider correlationIdLookup) { if (correlationIdLookup == null) { throw new ArgumentNullException("correlationIdLookup"); } _correlationIdLookup = correlationIdLookup; }
public ApplicationSettingsUpdatedEventHook( ICurrentUser currentUser, ICorrelationIdProvider correlationIdProvider ) { _currentUser = currentUser; _correlationIdProvider = correlationIdProvider; }
public UserPreferencesCreatedUpdatedDeletedEventHook( ICurrentUser currentUser, ICorrelationIdProvider correlationIdProvider ) { _currentUser = currentUser; _correlationIdProvider = correlationIdProvider; }
public HttpClientServicePatchTests() { logService = A.Fake <ILogService>(); correlationIdProvider = A.Fake <ICorrelationIdProvider>(); segmentClientOptions = new SegmentClientOptions { BaseAddress = new Uri("https://somewhere.com", UriKind.Absolute), }; }
public SitefinityMessageHandlerTests() { logger = A.Fake <ILogService>(); messageProcessor = A.Fake <IMessageProcessor>(); messagePropertiesService = A.Fake <IMessagePropertiesService>(); correlationIdProvider = A.Fake <ICorrelationIdProvider>(); logService = A.Fake <ILogService>(); sitefinityMessageHandler = new SitefinityMessageHandler(messageProcessor, messagePropertiesService, correlationIdProvider, logService); }
public NewAssessmentFunctions(ILogService logService, IResponseWithCorrelation responseWithCorrelation, IQuestionSetRepository questionSetRepository, IUserSessionRepository userSessionRepository, ISessionClient sessionClient, ICorrelationIdProvider correlationIdProvider) { this.logService = logService; this.responseWithCorrelation = responseWithCorrelation; this.questionSetRepository = questionSetRepository; this.sessionClient = sessionClient; this.correlationIdProvider = correlationIdProvider; this.userSessionRepository = userSessionRepository; }
public SitefinityMessageHandler( ILogService logService, IMessageProcessor processor, ICorrelationIdProvider correlationIdProvider) { this.logService = logService; this.processor = processor; this.correlationIdProvider = correlationIdProvider; }
public JobProfileSegmentRefresh( ILogService logService, IMessageProcessor processor, ICorrelationIdProvider correlationIdProvider) { this.logService = logService; this.processor = processor; this.correlationIdProvider = correlationIdProvider; }
private static void PushInfoToContext(HttpContext httpContext, ICorrelationIdProvider correlationIdProvider) { LogContext.PushProperty("Info", new { MachineName = Environment.MachineName, ClientIP = httpContext.Connection.RemoteIpAddress, RequestId = Guid.NewGuid(), CorrelationId = correlationIdProvider.EnsureCorrelationIdPresent() }); }
public HttpClientServicePatchTests() { logger = A.Fake <ILogService>(); segmentClientOptions = new JobProfileClientOptions { BaseAddress = new Uri("https://somewhere.com", UriKind.Absolute), Timeout = TimeSpan.MinValue, }; correlationIdProvider = A.Fake <ICorrelationIdProvider>(); }
public OutboxEventCreatedHook( IOutboxEventCreatedEvents outboxEventCreatedEvents, ICurrentUser currentUser, ICorrelationIdProvider correlationIdProvider ) { _outboxEventCreatedEvents = outboxEventCreatedEvents; _currentUser = currentUser; _correlationIdProvider = correlationIdProvider; }
public LoggerFactory(IRuntimeEnvironment runtimeEnvironment, IApplicationResourceFactory applicationResourceFactory, ILoggerExtension loggerExtension, ICorrelationIdProvider correlationIdProvider) { _runtimeEnvironment = runtimeEnvironment; _applicationResourceFactory = applicationResourceFactory; _loggerExtension = loggerExtension; _correlationIdProvider = correlationIdProvider; }
public SitefinityMessageHandler( IMessageProcessor messageProcessor, IMessagePropertiesService messagePropertiesService, ICorrelationIdProvider correlationIdProvider, ILogService logService) { this.messageProcessor = messageProcessor; this.messagePropertiesService = messagePropertiesService; this.correlationIdProvider = correlationIdProvider; this.logService = logService; }
public HttpClientServiceTests() { options = new SegmentClientOptions { BaseAddress = new Uri("http://baseAddress"), Timeout = TimeSpan.MinValue, }; logService = A.Fake <ILogService>(); correlationIdProvider = A.Fake <ICorrelationIdProvider>(); }
public ApiDescriptionFinder( IApiDescriptionCache cache, IOptions <AbpCorrelationIdOptions> abpCorrelationIdOptions, ICorrelationIdProvider correlationIdProvider, ICurrentTenant currentTenant) { Cache = cache; AbpCorrelationIdOptions = abpCorrelationIdOptions.Value; CorrelationIdProvider = correlationIdProvider; CurrentTenant = currentTenant; CancellationTokenProvider = NullCancellationTokenProvider.Instance; }
public OnEditSpecificationEvent( ILogger logger, ICorrelationIdProvider correlationIdProvider, ICalculationService calculationService) { Guard.ArgumentNotNull(logger, nameof(logger)); Guard.ArgumentNotNull(correlationIdProvider, nameof(correlationIdProvider)); Guard.ArgumentNotNull(calculationService, nameof(calculationService)); _logger = logger; _correlationIdProvider = correlationIdProvider; _calculationService = calculationService; }
public OnCalculationAggregationsJobCompleted( ILogger logger, ICorrelationIdProvider correlationIdProvider, IJobService jobService) { Guard.ArgumentNotNull(logger, nameof(logger)); Guard.ArgumentNotNull(correlationIdProvider, nameof(correlationIdProvider)); Guard.ArgumentNotNull(jobService, nameof(jobService)); _logger = logger; _correlationIdProvider = correlationIdProvider; _jobService = jobService; }
public OnTestExecution( ILogger logger, ICorrelationIdProvider correlationIdProvider, ITestEngineService testEngineService) { Guard.ArgumentNotNull(logger, nameof(logger)); Guard.ArgumentNotNull(correlationIdProvider, nameof(correlationIdProvider)); Guard.ArgumentNotNull(testEngineService, nameof(testEngineService)); _logger = logger; _correlationIdProvider = correlationIdProvider; _testEngineService = testEngineService; }
public SerilogFactory(Func<LoggerConfiguration> loggerConfigurationProvider, ICorrelationIdProvider correlationIdProvider, LogLevelEnum defaultMinimumLogLevel, IFullyQualifiedName defaultLoggerSource, string sourceFqnPropertyName, string correlationIdPropertyName) { _loggerConfigurationProvider = loggerConfigurationProvider; _correlationIdProvider = correlationIdProvider; _defaultMinimumLogLevel = defaultMinimumLogLevel; _defaultLoggerSource = defaultLoggerSource; _sourceFqnPropertyName = sourceFqnPropertyName; _correlationIdPropertyName = correlationIdPropertyName; }
public QueueLoggerFactory( IRuntimeEnvironment runtimeEnvironment, IApplicationResourceSettingNameProvider nameProvider, IConfiguration configuration, IQueueSerializer queueSerializer, IQueueLoggerExtension queueLoggerExtension, ICorrelationIdProvider correlationIdProvider, LogLevelEnum defaultMinimumLogLevel, IFullyQualifiedName defaultLoggerSource) { _runtimeEnvironment = runtimeEnvironment; _queueSerializer = queueSerializer; _queueLoggerExtension = queueLoggerExtension; _correlationIdProvider = correlationIdProvider; _defaultMinimumLogLevel = defaultMinimumLogLevel; _defaultLoggerSource = defaultLoggerSource; _queueName = configuration[nameProvider.SettingName(ApplicationSupportComponentIdentity, "logger-queue")]; _storageAccountConnectionString = configuration[nameProvider.StorageAccountConnectionString(ApplicationSupportComponentIdentity)]; }
public CorrelationIdEnricher(ICorrelationIdProvider correlationIdProvider) : this(correlationIdProvider, "CorrelationId") { }
public CorrelationIdEnricher(ICorrelationIdProvider correlationIdProvider, string propertyName) { _correlationIdProvider = correlationIdProvider; _propertyName = propertyName; }