protected override IEventHubQueueCacheFactory CreateCacheFactory(EventHubStreamProviderSettings providerSettings)
            {
                var eventHubPath     = this.hubSettings.Path;
                var sharedDimensions = new EventHubMonitorAggregationDimensions(eventHubPath);

                return(new CacheFactoryForTesting(providerSettings, this.SerializationManager, this.createdCaches, sharedDimensions, this.serviceProvider.GetRequiredService <ILoggerFactory>()));
            }
예제 #2
0
        protected override IEventHubQueueCacheFactory CreateCacheFactory(EventHubStreamCachePressureOptions options)
        {
            var eventHubPath     = this.ehOptions.Path;
            var sharedDimensions = new EventHubMonitorAggregationDimensions(eventHubPath);

            return(new CacheFactoryForTesting(this.Name, this.cacheOptions, this.evictionOptions, this.staticticOptions, base.dataAdapter, this.SerializationManager, this.createdCaches, sharedDimensions, this.serviceProvider.GetRequiredService <ILoggerFactory>()));
        }
            protected override IEventHubQueueCacheFactory CreateCacheFactory(EventHubStreamProviderSettings providerSettings)
            {
                var globalConfig     = this.serviceProvider.GetRequiredService <GlobalConfiguration>();
                var nodeConfig       = this.serviceProvider.GetRequiredService <NodeConfiguration>();
                var eventHubPath     = hubSettings.Path;
                var sharedDimensions = new EventHubMonitorAggregationDimensions(globalConfig, nodeConfig, eventHubPath);

                return(new CacheFactoryForTesting(providerSettings, SerializationManager, this.createdCaches, sharedDimensions));
            }
        protected override IEventHubQueueCacheFactory CreateCacheFactory(EventHubStreamCachePressureOptions cacheOptions)
        {
            var loggerFactory    = this.serviceProvider.GetRequiredService <ILoggerFactory>();
            var eventHubPath     = this.ehOptions.Path;
            var sharedDimensions = new EventHubMonitorAggregationDimensions(eventHubPath);
            Func <EventHubCacheMonitorDimensions, ILoggerFactory, ITelemetryProducer, ICacheMonitor>         cacheMonitorFactory     = (dimensions, logger, telemetryProducer) => CacheMonitorForTesting.Instance;
            Func <EventHubBlockPoolMonitorDimensions, ILoggerFactory, ITelemetryProducer, IBlockPoolMonitor> blockPoolMonitorFactory = (dimensions, logger, telemetryProducer) => BlockPoolMonitorForTesting.Instance;

            return(new CacheFactoryForMonitorTesting(this.cachePressureInjectionMonitor, this.cacheOptions, this.evictionOptions, this.staticticOptions, this.serializationManager,
                                                     sharedDimensions, loggerFactory, cacheMonitorFactory, blockPoolMonitorFactory));
        }
            protected override IEventHubQueueCacheFactory CreateCacheFactory(EventHubStreamProviderSettings providerSettings)
            {
                var globalConfig     = this.serviceProvider.GetRequiredService <GlobalConfiguration>();
                var nodeConfig       = this.serviceProvider.GetRequiredService <NodeConfiguration>();
                var eventHubPath     = hubSettings.Path;
                var sharedDimensions = new EventHubMonitorAggregationDimensions(globalConfig, nodeConfig, eventHubPath);
                Func <EventHubCacheMonitorDimensions, Logger, ICacheMonitor>         cacheMonitorFactory     = (dimensions, logger) => CacheMonitorForTesting.Instance;
                Func <EventHubBlockPoolMonitorDimensions, Logger, IBlockPoolMonitor> blockPoolMonitorFactory = (dimensions, logger) => BlockPoolMonitorForTesting.Instance;

                return(new CacheFactoryForMonitorTesting(this.cachePressureInjectionMonitor, providerSettings, SerializationManager,
                                                         sharedDimensions, cacheMonitorFactory, blockPoolMonitorFactory));
            }
예제 #6
0
 public CacheFactoryForMonitorTesting(
     CachePressureInjectionMonitor cachePressureInjectionMonitor,
     EventHubStreamCachePressureOptions cacheOptions,
     StreamCacheEvictionOptions streamCacheEviction,
     StreamStatisticOptions statisticOptions,
     IEventHubDataAdapter dataAdater,
     EventHubMonitorAggregationDimensions sharedDimensions,
     ILoggerFactory loggerFactory,
     Func <EventHubCacheMonitorDimensions, ILoggerFactory, ITelemetryProducer, ICacheMonitor> cacheMonitorFactory             = null,
     Func <EventHubBlockPoolMonitorDimensions, ILoggerFactory, ITelemetryProducer, IBlockPoolMonitor> blockPoolMonitorFactory = null)
     : base(cacheOptions, streamCacheEviction, statisticOptions, dataAdater, sharedDimensions, cacheMonitorFactory, blockPoolMonitorFactory)
 {
     this.cachePressureInjectionMonitor = cachePressureInjectionMonitor;
 }
            protected override IEventHubQueueCache CreateCache(
                string partition,
                IEventHubDataAdapter dataAdatper,
                StreamStatisticOptions options,
                StreamCacheEvictionOptions evictionOptions,
                IStreamQueueCheckpointer <string> checkpointer,
                ILoggerFactory loggerFactory,
                IObjectPool <FixedSizeBuffer> bufferPool,
                string blockPoolId,
                TimePurgePredicate timePurge,
                EventHubMonitorAggregationDimensions sharedDimensions,
                ITelemetryProducer telemetryProducer)
            {
                var cacheMonitorDimensions = new EventHubCacheMonitorDimensions(sharedDimensions, partition, blockPoolId);
                var cacheMonitor           = this.CacheMonitorFactory(cacheMonitorDimensions, loggerFactory, telemetryProducer);
                var cacheLogger            = loggerFactory.CreateLogger($"{typeof(EventHubQueueCache).FullName}.{this.name}.{partition}");
                var evictionStrategy       = new ChronologicalEvictionStrategy(cacheLogger, timePurge, cacheMonitor, options.StatisticMonitorWriteInterval);
                //set defaultMaxAddCount to 10 so TryCalculateCachePressureContribution will start to calculate real contribution shortly
                var cache = new QueueCacheForTesting(DefaultMaxAddCount, bufferPool, dataAdatper, evictionStrategy, checkpointer,
                                                     cacheLogger, cacheMonitor, options.StatisticMonitorWriteInterval);

                this.caches.Add(cache);
                return(cache);
            }
 public CacheFactoryForTesting(EventHubStreamProviderSettings providerSettings,
                               SerializationManager serializationManager, List <IEventHubQueueCache> caches, EventHubMonitorAggregationDimensions sharedDimensions,
                               Func <EventHubCacheMonitorDimensions, Logger, ICacheMonitor> cacheMonitorFactory             = null,
                               Func <EventHubBlockPoolMonitorDimensions, Logger, IBlockPoolMonitor> blockPoolMonitorFactory = null)
     : base(providerSettings, serializationManager, sharedDimensions, cacheMonitorFactory, blockPoolMonitorFactory)
 {
     this.caches = caches;
 }
예제 #9
0
 public CacheFactoryForTesting(string name, EventHubStreamCachePressureOptions cacheOptions, StreamCacheEvictionOptions evictionOptions, StreamStatisticOptions statisticOptions,
                               IEventHubDataAdapter dataAdapter, SerializationManager serializationManager, ConcurrentBag <QueueCacheForTesting> caches, EventHubMonitorAggregationDimensions sharedDimensions,
                               ILoggerFactory loggerFactory,
                               Func <EventHubCacheMonitorDimensions, ILoggerFactory, ITelemetryProducer, ICacheMonitor> cacheMonitorFactory             = null,
                               Func <EventHubBlockPoolMonitorDimensions, ILoggerFactory, ITelemetryProducer, IBlockPoolMonitor> blockPoolMonitorFactory = null)
     : base(cacheOptions, evictionOptions, statisticOptions, dataAdapter, serializationManager, sharedDimensions, cacheMonitorFactory, blockPoolMonitorFactory)
 {
     this.name   = name;
     this.caches = caches;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="dimensions"></param>
 /// <param name="ehPartition"></param>
 /// <param name="blockPoolId"></param>
 public EventHubCacheMonitorDimensions(EventHubMonitorAggregationDimensions dimensions, string ehPartition, string blockPoolId)
     : base(dimensions, ehPartition)
 {
     this.BlockPoolId = blockPoolId;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="dimensions"></param>
 public EventHubMonitorAggregationDimensions(EventHubMonitorAggregationDimensions dimensions)
 {
     this.EventHubPath = dimensions.EventHubPath;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="dimensions"></param>
 /// <param name="ehPartition"></param>
 public EventHubReceiverMonitorDimensions(EventHubMonitorAggregationDimensions dimensions, string ehPartition)
     : base(dimensions)
 {
     this.EventHubPartition = ehPartition;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="dimensions"></param>
 /// <param name="blockPoolId"></param>
 public EventHubBlockPoolMonitorDimensions(EventHubMonitorAggregationDimensions dimensions, string blockPoolId)
     : base(dimensions)
 {
     this.BlockPoolId = blockPoolId;
 }
                protected override IEventHubQueueCache CreateCache(string partition, EventHubStreamProviderSettings providerSettings, IStreamQueueCheckpointer <string> checkpointer,
                                                                   Logger cacheLogger, IObjectPool <FixedSizeBuffer> bufferPool, string blockPoolId, TimePurgePredicate timePurge,
                                                                   SerializationManager serializationManager, EventHubMonitorAggregationDimensions sharedDimensions)
                {
                    var cacheMonitorDimensions = new EventHubCacheMonitorDimensions(sharedDimensions, partition, blockPoolId);
                    var cacheMonitor           = this.CacheMonitorFactory(cacheMonitorDimensions, cacheLogger);
                    //set defaultMaxAddCount to 10 so TryCalculateCachePressureContribution will start to calculate real contribution shortly
                    var cache = new EventHubQueueCache(defaultMaxAddCount, checkpointer, new EventHubDataAdapter(serializationManager, bufferPool),
                                                       EventHubDataComparer.Instance, cacheLogger, new EventHubCacheEvictionStrategy(cacheLogger, cacheMonitor, providerSettings.StatisticMonitorWriteInterval, timePurge),
                                                       cacheMonitor, providerSettings.StatisticMonitorWriteInterval);

                    this.caches.Add(cache);
                    return(cache);
                }
예제 #15
0
 public CacheFactoryForMonitorTesting(CachePressureInjectionMonitor cachePressureInjectionMonitor, EventHubStreamOptions options,
                                      SerializationManager serializationManager, EventHubMonitorAggregationDimensions sharedDimensions,
                                      ILoggerFactory loggerFactory,
                                      Func <EventHubCacheMonitorDimensions, ILoggerFactory, ITelemetryProducer, ICacheMonitor> cacheMonitorFactory             = null,
                                      Func <EventHubBlockPoolMonitorDimensions, ILoggerFactory, ITelemetryProducer, IBlockPoolMonitor> blockPoolMonitorFactory = null)
     : base(options, serializationManager, sharedDimensions, loggerFactory, cacheMonitorFactory, blockPoolMonitorFactory)
 {
     this.cachePressureInjectionMonitor = cachePressureInjectionMonitor;
 }
 public CacheFactoryForTesting(EventHubStreamProviderSettings providerSettings,
                               SerializationManager serializationManager, ConcurrentBag <QueueCacheForTesting> caches, EventHubMonitorAggregationDimensions sharedDimensions,
                               ILoggerFactory loggerFactory,
                               Func <EventHubCacheMonitorDimensions, ILoggerFactory, ITelemetryProducer, ICacheMonitor> cacheMonitorFactory             = null,
                               Func <EventHubBlockPoolMonitorDimensions, ILoggerFactory, ITelemetryProducer, IBlockPoolMonitor> blockPoolMonitorFactory = null)
     : base(providerSettings, serializationManager, sharedDimensions, loggerFactory, cacheMonitorFactory, blockPoolMonitorFactory)
 {
     this.caches = caches;
 }
 public CacheFactoryForMonitorTesting(CachePressureInjectionMonitor cachePressureInjectionMonitor, EventHubStreamProviderSettings providerSettings,
                                      SerializationManager serializationManager, EventHubMonitorAggregationDimensions sharedDimensions,
                                      Func <EventHubCacheMonitorDimensions, Logger, ICacheMonitor> cacheMonitorFactory             = null,
                                      Func <EventHubBlockPoolMonitorDimensions, Logger, IBlockPoolMonitor> blockPoolMonitorFactory = null)
     : base(providerSettings, serializationManager, sharedDimensions, cacheMonitorFactory, blockPoolMonitorFactory)
 {
     this.cachePressureInjectionMonitor = cachePressureInjectionMonitor;
 }