Ejemplo n.º 1
0
 public ProcessOrSingleTimeWindowServiceProfiler(IAmbientServiceProfiler metrics, string scopeName, Regex?systemGroupTransform)
 {
     _profiler  = metrics;
     _scopeName = scopeName;
     _systemToGroupTransform   = systemGroupTransform;
     _accumulatorsByGroup      = new ConcurrentDictionary <string, AmbientServiceProfilerAccumulator>();
     _activeGroupByCallContext = new ConcurrentDictionary <object, CallContextActiveSystemData>();
     _callContextKey           = new AsyncLocal <object>();
     _profiler.RegisterSystemSwitchedNotificationSink(this);
 }
Ejemplo n.º 2
0
        /// <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);
        }