public ClientDiagnostics(string clientNamespace, bool isActivityEnabled) { if (isActivityEnabled) { _source = new DiagnosticListener(clientNamespace); } }
/// <inheritdoc /> public OmexServiceRemotingDispatcher( ServiceContext serviceContext, IService serviceImplementation, IServiceRemotingMessageBodyFactory?serviceRemotingMessageBodyFactory = null, DiagnosticListener?diagnosticListener = null) : base(serviceContext, serviceImplementation, serviceRemotingMessageBodyFactory) { m_diagnosticListener = diagnosticListener ?? Diagnostics.DefaultListener; }
public DiagnosticScopeFactory(string clientNamespace, string?resourceProviderNamespace, bool isActivityEnabled) { _resourceProviderNamespace = resourceProviderNamespace; IsActivityEnabled = isActivityEnabled; if (IsActivityEnabled) { _source = new DiagnosticListener(clientNamespace); } }
public CorrelationManager( ICorrelationContextFactory correlationContextFactory, ICorrelationIdFactory correlationIdFactory, ILogger <CorrelationManager> logger, DiagnosticListener diagnosticListener ) : this(correlationContextFactory, correlationIdFactory, logger) { _diagnosticListener = diagnosticListener ?? throw new ArgumentNullException(nameof(diagnosticListener)); }
public RootActivity( ICorrelationContextFactory correlationContextFactory, ILogger logger, DiagnosticListener?diagnosticListener) { _correlationContextFactory = correlationContextFactory ?? throw new ArgumentNullException(nameof(correlationContextFactory)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _diagnosticListener = diagnosticListener; }
public IDisposable Subscribe(IObserver <DiagnosticListener> observer) { lock (s_allListenersLock) { // Call back for each existing listener on the new callback (catch-up). for (DiagnosticListener?cur = s_allListeners; cur != null; cur = cur._next) { observer.OnNext(cur); } // Add the observer to the list of subscribers. _subscriptions = new AllListenerSubscription(this, observer, _subscriptions); return(_subscriptions); } }
public DiagnosticScopeFactory(string clientNamespace, string?resourceProviderNamespace, bool isActivityEnabled) { _resourceProviderNamespace = resourceProviderNamespace; IsActivityEnabled = isActivityEnabled; if (IsActivityEnabled) { var listeners = LazyInitializer.EnsureInitialized(ref _listeners); lock (listeners !) { if (!listeners.TryGetValue(clientNamespace, out _source)) { _source = new DiagnosticListener(clientNamespace); listeners[clientNamespace] = _source; } } } }
public DiagnosticScopeFactory(string clientNamespace, string?resourceProviderNamespace, bool isActivityEnabled) { this.resourceProviderNamespace = resourceProviderNamespace; this.IsActivityEnabled = isActivityEnabled; if (this.IsActivityEnabled) { #pragma warning disable CS8601 // Possible null reference assignment. var listeners = LazyInitializer.EnsureInitialized <Dictionary <string, DiagnosticListener> >(ref DiagnosticScopeFactory.listeners); #pragma warning restore CS8601 // Possible null reference assignment. lock (listeners !) { if (!listeners.TryGetValue(clientNamespace, out this.source)) { this.source = new DiagnosticListener(clientNamespace); listeners[clientNamespace] = this.source; } } } }
public ServiceRemotingClientWrapper(IServiceRemotingClient client, DiagnosticListener?diagnosticListener = null) { Client = client; m_diagnosticListener = diagnosticListener ?? Diagnostics.DefaultListener; }
public async Task ExecuteAsync(ViewComponentContext context) { if (context == null) { throw new ArgumentNullException(nameof(context)); } var viewEngine = ViewEngine ?? ResolveViewEngine(context); var viewContext = context.ViewContext; var isNullOrEmptyViewName = string.IsNullOrEmpty(ViewName); ViewEngineResult? result = null; IEnumerable <string>?originalLocations = null; if (!isNullOrEmptyViewName) { // If view name was passed in is already a path, the view engine will handle this. result = viewEngine.GetView(viewContext.ExecutingFilePath, ViewName !, isMainPage: false); originalLocations = result.SearchedLocations; } if (result == null || !result.Success) { // This will produce a string like: // // Components/Cart/Default // // The view engine will combine this with other path info to search paths like: // // Views/Shared/Components/Cart/Default.cshtml // Views/Home/Components/Cart/Default.cshtml // Areas/Blog/Views/Shared/Components/Cart/Default.cshtml // // This supports a controller or area providing an override for component views. var viewName = isNullOrEmptyViewName ? DefaultViewName : ViewName; var qualifiedViewName = string.Format( CultureInfo.InvariantCulture, ViewPathFormat, context.ViewComponentDescriptor.ShortName, viewName); result = viewEngine.FindView(viewContext, qualifiedViewName, isMainPage: false); } var view = result.EnsureSuccessful(originalLocations).View !; using (view as IDisposable) { if (_diagnosticListener == null) { _diagnosticListener = viewContext.HttpContext.RequestServices.GetRequiredService <DiagnosticListener>(); } _diagnosticListener.ViewComponentBeforeViewExecute(context, view); var childViewContext = new ViewContext( viewContext, view, ViewData ?? context.ViewData, context.Writer); await view.RenderAsync(childViewContext); _diagnosticListener.ViewComponentAfterViewExecute(context, view); } }