public static GlimpseCoreAgentServiceCollectionBuilder RunningAgentWeb(this GlimpseCoreServiceCollectionBuilder services, Action <GlimpseCoreAgentOptions> setupAction) { if (setupAction != null) { services.Configure(setupAction); } return(new GlimpseCoreAgentServiceCollectionBuilder(services)); }
public static GlimpseCoreServiceCollectionBuilder AddGlimpseCore(this IServiceCollection services) { services.TryAdd(GlimpseCoreServices.GetDefaultServices()); var extensionProvider = services.BuildServiceProvider().GetService <IExtensionProvider <IRegisterServices> >(); var glimpseCoreServiceCollectionBuilder = new GlimpseCoreServiceCollectionBuilder(services); foreach (var registration in extensionProvider.Instances) { registration.RegisterServices(glimpseCoreServiceCollectionBuilder); } return(glimpseCoreServiceCollectionBuilder); }
private void RegisterPublisher(GlimpseCoreServiceCollectionBuilder services) { var configurationBuilder = new ConfigurationBuilder(); var fileProvider = configurationBuilder.GetFileProvider(); if (fileProvider.GetFileInfo("glimpsecore.json").Exists) { var configuration = configurationBuilder.AddJsonFile("glimpsecore.json").Build(); var section = configuration.GetSection("resources"); services.Configure <ResourceOptions>(section); services.Replace(new ServiceDescriptor(typeof(IMessagePublisher), typeof(HttpMessagePublisher), ServiceLifetime.Transient)); } // TODO: If I reach this line, than GlimpseCore has no way to send data from point A to B. Should we blow up? }
public void RegisterServices(GlimpseCoreServiceCollectionBuilder services) { services.AddOptions(); RegisterPublisher(services); // // Common // services.AddMiddlewareAnalysis(); services.AddTransient <IGlimpseCoreAgent, GlimpseCoreAgent>(); services.AddSingleton <IAgentBroker, DefaultAgentBroker>(); // // Options // services.AddTransient <IConfigureOptions <GlimpseCoreAgentOptions>, GlimpseCoreAgentOptionsSetup>(); services.AddSingleton <IRequestIgnorerUriProvider, DefaultRequestIgnorerUriProvider>(); services.AddSingleton <IRequestIgnorerStatusCodeProvider, DefaultRequestIgnorerStatusCodeProvider>(); services.AddSingleton <IRequestIgnorerContentTypeProvider, DefaultRequestIgnorerContentTypeProvider>(); services.AddSingleton <IExtensionProvider <IRequestIgnorer>, DefaultExtensionProvider <IRequestIgnorer> >(); services.AddSingleton <IExtensionProvider <IInspectorFunction>, DefaultExtensionProvider <IInspectorFunction> >(); services.AddSingleton <IExtensionProvider <IInspector>, DefaultExtensionProvider <IInspector> >(); services.AddSingleton <IExtensionProvider <IAgentStartup>, DefaultExtensionProvider <IAgentStartup> >(); // // Messages // services.AddSingleton <IMessageConverter, DefaultMessageConverter>(); services.AddTransient <IMessagePayloadFormatter, DefaultMessagePayloadFormatter>(); services.AddTransient <IMessageIndexProcessor, DefaultMessageIndexProcessor>(); services.AddTransient <IMessageTypeProcessor, DefaultMessageTypeProcessor>(); // // Common // services.AddTransient <IAgentStartupManager, DefaultAgentStartupManager>(); services.AddTransient <IRequestIgnorerManager, DefaultRequestIgnorerManager>(); services.AddTransient <IInspectorFunctionManager, DefaultInspectorFunctionManager>(); services.AddTransient <IExceptionProcessor, ExceptionProcessor>(); services.AddTransient <WebDiagnosticsListener>(); if (!services.Any(s => s.ServiceType == typeof(IResourceOptionsProvider))) { services.AddSingleton <IResourceOptionsProvider, OptionsResourceOptionsProvider>(); } }
public void RegisterServices(GlimpseCoreServiceCollectionBuilder services) { services.AddOptions(); // // Common // services.AddSingleton <IServerBroker, DefaultServerBroker>(); services.AddSingleton <IStorage, InMemoryStorage>(); services.AddSingleton <IResourceManager, ResourceManager>(); // // Options // services.AddTransient <IConfigureOptions <GlimpseCoreServerOptions>, GlimpseCoreServerOptionsSetup>(); services.AddTransient <IExtensionProvider <IAllowClientAccess>, DefaultExtensionProvider <IAllowClientAccess> >(); services.AddTransient <IExtensionProvider <IAllowAgentAccess>, DefaultExtensionProvider <IAllowAgentAccess> >(); services.AddTransient <IExtensionProvider <IResource>, DefaultExtensionProvider <IResource> >(); services.AddTransient <IExtensionProvider <IResourceStartup>, DefaultExtensionProvider <IResourceStartup> >(); services.AddSingleton <IAllowRemoteProvider, DefaultAllowRemoteProvider>(); services.AddSingleton <IMetadataProvider, DefaultMetadataProvider>(); if (!services.Any(s => s.ServiceType == typeof(IMessagePublisher))) { services.AddSingleton <IMessagePublisher, InProcessPublisher>(); } if (services.Any(s => s.ServiceType == typeof(IResourceOptionsProvider))) { services.Replace(new ServiceDescriptor( typeof(IResourceOptionsProvider), typeof(DefaultResourceOptionsProvider), ServiceLifetime.Singleton)); } else { services.AddSingleton <IResourceOptionsProvider, DefaultResourceOptionsProvider>(); } }
public static GlimpseCoreAgentServiceCollectionBuilder RunningAgentWeb(this GlimpseCoreServiceCollectionBuilder services) { return(services.RunningAgentWeb(null)); }