Пример #1
0
 /// <summary>
 /// Create a timed scope
 /// </summary>
 /// <param name="scopeDefinition">Timed scope definition</param>
 /// <param name="initialResult">The default result for the scope</param>
 /// <param name="customLogger">Use a custom logger for the timed scope</param>
 /// <param name="replayEventConfigurator">Replay event configurator</param>
 /// <param name="timedScopeStackManager">Timed scope stack manager</param>
 /// <param name="correlationData">Correlation data</param>
 /// <param name="machineInformation">Machine Information</param>
 /// <returns>Newly created scope</returns>
 public static TimedScope Create(TimedScopeDefinition scopeDefinition, CorrelationData correlationData, IMachineInformation machineInformation,
                                 ITimedScopeLogger customLogger, IReplayEventConfigurator replayEventConfigurator, ITimedScopeStackManager timedScopeStackManager,
                                 TimedScopeResult initialResult = default(TimedScopeResult))
 {
     return(new TimedScope(scopeDefinition, correlationData, customLogger, replayEventConfigurator, machineInformation, timedScopeStackManager)
     {
         TimedScopeData = correlationData,
         RunningTransaction = TransactionMonitor.RunningTransaction(correlationData),
         Result = initialResult,
     });
 }
Пример #2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="scopeDefinition">Timed scope definition</param>
        /// <param name="scopeLogger">Scope metrics logger</param>
        /// <param name="replayEventConfigurator">Replay event configurator</param>
        /// <param name="machineInformation">Machine Information</param>
        /// <param name="timedScopeStackManager">Timed scope stack manager</param>
        /// <param name="correlationData">Correlation data</param>
        private TimedScope(TimedScopeDefinition scopeDefinition, CorrelationData correlationData, ITimedScopeLogger scopeLogger, IReplayEventConfigurator replayEventConfigurator,
                           IMachineInformation machineInformation, ITimedScopeStackManager timedScopeStackManager)
        {
            Code.ExpectsArgument(scopeDefinition, nameof(scopeDefinition), TaggingUtilities.ReserveTag(0x238174da /* tag_96xt0 */));
            Code.ExpectsArgument(scopeLogger, nameof(scopeLogger), TaggingUtilities.ReserveTag(0x238174db /* tag_96xt1 */));
            Code.ExpectsArgument(replayEventConfigurator, nameof(replayEventConfigurator), TaggingUtilities.ReserveTag(0x238174dc /* tag_96xt2 */));
            Code.ExpectsArgument(timedScopeStackManager, nameof(timedScopeStackManager), TaggingUtilities.ReserveTag(0x23817062 /* tag_96xb8 */));

            ScopeDefinition         = scopeDefinition;
            ScopeLogger             = scopeLogger;
            ReplayEventConfigurator = replayEventConfigurator;
            CorrelationData         = correlationData;
            MachineInformation      = machineInformation;
            TimedScopeStackManager  = timedScopeStackManager;
        }
Пример #3
0
 /// <summary>
 /// Creates a scope (and starts by default)
 /// </summary>
 /// <param name="definition">TimeScope definition</param>
 /// <param name="initialResult">Initial result to use</param>
 /// <param name="startScope">Should the scope be automatically started (for use in e.g. 'using' statement)</param>
 public TimedScope Create(TimedScopeDefinition definition, TimedScopeResult initialResult, bool startScope = true)
 => definition.Create(m_correlation.CurrentCorrelation, m_machineInformation, m_scopeLogger, m_replayEventConfigurator, m_timedScopeStackManager, initialResult, startScope);