internal AmbientLogFilter(string name, IAmbientSettingsSet?settingsSet) { _name = name; _logLevelSetting = AmbientSettings.GetSetting <AmbientLogLevel>(settingsSet, name + "-" + nameof(AmbientLogFilter) + "-LogLevel", "The AmbientLogLevel above which events should not be logged. The default value is AmbientLogLevel.Information.", AmbientLogLevel.Information, s => (AmbientLogLevel)Enum.Parse(typeof(AmbientLogLevel), s)); _typeAllowSetting = AmbientSettings.GetSetting <Regex?>(settingsSet, name + "-" + nameof(AmbientLogFilter) + "-TypeAllow", "A regular expression indicating which logger owner types should be allowed. Blocks takes precedence over allows. The default value is null, which allows all types.", null, s => new Regex(s, RegexOptions.Compiled)); _typeBlockSetting = AmbientSettings.GetSetting <Regex?>(settingsSet, name + "-" + nameof(AmbientLogFilter) + "-TypeBlock", "A regular expression indicating which logger owner types should be blocked. Blocks takes precedence over allows. The default value is null, which blocks no types.", null, s => new Regex(s, RegexOptions.Compiled)); _categoryAllowSetting = AmbientSettings.GetSetting <Regex?>(settingsSet, name + "-" + nameof(AmbientLogFilter) + "-CategoryAllow", "A regular expression indicating which categories should be allowed. Blocks takes precedence over allows. The default value is null, which allows all categories.", null, s => new Regex(s, RegexOptions.Compiled)); _categoryBlockSetting = AmbientSettings.GetSetting <Regex?>(settingsSet, name + "-" + nameof(AmbientLogFilter) + "-CategoryBlock", "A regular expression indicating which categories should be blocked. Blocks takes precedence over allows. The default value is null, which blocks no categories.", null, s => new Regex(s, RegexOptions.Compiled)); }
/// <summary> /// Constructs an AmbientServiceProfilerCoordinator using the specified settings set. /// </summary> /// <param name="settingsSet"></param> public AmbientServiceProfilerCoordinator(IAmbientSettingsSet?settingsSet) { _defaultSystemGroupTransformSetting = AmbientSettings.GetSettingsSetSetting <Regex?>(settingsSet, nameof(AmbientServiceProfilerCoordinator) + "-DefaultSystemGroupTransform", @"A `Regex` string used to transform the system identifier to a group identifier. The regular expression will attempt to match the system identifier, with the values for any matching match groups being concatenated into the system group identifier.", s => string.IsNullOrEmpty(s) ? (Regex?)null : new Regex(s, RegexOptions.Compiled)); _scopeDistributor = new AsyncLocal <ScopeOnSystemSwitchedDistributor>(); _eventBroadcaster = _AmbientServiceProfiler.Local; _eventBroadcaster?.RegisterSystemSwitchedNotificationSink(this); }
/// <summary> /// Constructs a AmbientBottleneckTracker using the specified settings set. /// </summary> /// <param name="settingsSet">An <see cref="IAmbientSettingsSet"/> to get settings from.</param> public AmbientBottleneckSurveyorCoordinator(IAmbientSettingsSet?settingsSet) { _defaultAllowSetting = AmbientSettings.GetSetting <Regex?>(settingsSet, nameof(AmbientBottleneckSurveyorCoordinator) + "-DefaultAllow", @"A `Regex` string used to match bottleneck identifiers that should be tracked. By default, all bottlenecks are allowed.", s => string.IsNullOrEmpty(s) ? (Regex?)null : new Regex(s, RegexOptions.Compiled)); _defaultBlockSetting = AmbientSettings.GetSetting <Regex?>(settingsSet, nameof(AmbientBottleneckSurveyorCoordinator) + "-DefaultBlock", @"A `Regex` string used to match bottleneck identifiers that should NOT be tracked. By default, no bottlenecks are blocked.", s => string.IsNullOrEmpty(s) ? (Regex?)null : new Regex(s, RegexOptions.Compiled)); _bottleneckDetector = _AmbientBottleneckDetector.Local; _callContextSurveyor = new CallContextSurveyManager(_bottleneckDetector); _threadSurveyor = new ThreadSurveyManager(_bottleneckDetector); }
public BasicAmbientCache(IAmbientSettingsSet?settings) { _callFrequencyToEject = AmbientSettings.GetSetting <int>(settings, nameof(BasicAmbientCache) + "-EjectFrequency", "The number of cache calls between cache ejections where at least one timed and one untimed entry is ejected from the cache.", s => Int32.Parse(s !, System.Globalization.CultureInfo.InvariantCulture), "100"); _countToEject = AmbientSettings.GetSetting <int>(settings, nameof(BasicAmbientCache) + "-MaximumItemCount", "The maximum number of both timed and untimed items to allow in the cache before ejecting items.", s => Int32.Parse(s !, System.Globalization.CultureInfo.InvariantCulture), "1000"); _minCacheEntries = AmbientSettings.GetSetting <int>(settings, nameof(BasicAmbientCache) + "-MinimumItemCount", "The minimum number of unexpired both timed and untimed items to keep in the cache at all times.", s => Int32.Parse(s !, System.Globalization.CultureInfo.InvariantCulture), "1"); }