/// <summary> /// Base constructor for <see cref="InstrumentationListener"></see>. /// </summary> /// <param name="instanceName">Unique name for this instance</param> /// <param name="performanceCountersEnabled">True if performance counter reporting is enabled</param> /// <param name="eventLoggingEnabled">True if event logging is enabled</param> /// <param name="nameFormatter">Creates unique name for each <see cref="PerformanceCounter"/> instance.</param> protected InstrumentationListener(string instanceName, bool performanceCountersEnabled, bool eventLoggingEnabled, IPerformanceCounterNameFormatter nameFormatter) : this(CreateDefaultInstanceNames(instanceName), performanceCountersEnabled, eventLoggingEnabled, nameFormatter) { }
/// <summary> /// Base constructor for <see cref="InstrumentationListener"></see>. /// </summary> /// <overloads> /// Base constructor for <see cref="InstrumentationListener"></see>. /// </overloads> /// <param name="performanceCountersEnabled">True if performance counter reporting is enabled</param> /// <param name="eventLoggingEnabled">True if event logging is enabled</param> /// <param name="nameFormatter">Creates unique name for each <see cref="PerformanceCounter"/> instance.</param> protected InstrumentationListener(bool performanceCountersEnabled, bool eventLoggingEnabled, IPerformanceCounterNameFormatter nameFormatter) { string[] instanceNames = new string[] { DefaultCounterName }; Initialize(performanceCountersEnabled, eventLoggingEnabled, nameFormatter, instanceNames); }
public void SetUp() { nameFormatter = new FixedPrefixNameFormatter("Prefix - "); formattedInstanceName = nameFormatter.CreateName(instanceName); totalConnectionOpenedCounter = new EnterpriseLibraryPerformanceCounter( NewDataInstrumentationProvider.CounterCategoryName, NewDataInstrumentationProvider.TotalConnectionOpenedCounter, formattedInstanceName); totalConnectionFailedCounter = new EnterpriseLibraryPerformanceCounter( NewDataInstrumentationProvider.CounterCategoryName, NewDataInstrumentationProvider.TotalConnectionFailedCounter, formattedInstanceName); totalCommandsExecutedCounter = new EnterpriseLibraryPerformanceCounter( NewDataInstrumentationProvider.CounterCategoryName, NewDataInstrumentationProvider.TotalCommandsExecutedCounter, formattedInstanceName); totalCommandsFailedCounter = new EnterpriseLibraryPerformanceCounter( NewDataInstrumentationProvider.CounterCategoryName, NewDataInstrumentationProvider.TotalCommandsFailedCounter, formattedInstanceName); provider = new NewDataInstrumentationProvider(instanceName, true, true, nameFormatter); ClearExistingCounts(); }
/// <summary> /// Initializes a new instance of the <see cref="ValidationInstrumentationProvider"/> class. /// </summary> /// <param name="performanceCountersEnabled"><code>true</code> if performance counters should be updated.</param> /// <param name="eventLoggingEnabled"><code>true</code> if event log entries should be written.</param> /// <param name="nameFormatter">Creates unique name for each <see cref="PerformanceCounter"/> instance.</param> public ValidationInstrumentationProvider(bool performanceCountersEnabled, bool eventLoggingEnabled, IPerformanceCounterNameFormatter nameFormatter) : base(performanceCountersEnabled, eventLoggingEnabled, nameFormatter) { this.eventLogEntryFormatter = new EventLogEntryFormatter(Resources.BlockName); }
private void FormatCounterInstanceNames(IPerformanceCounterNameFormatter nameFormatter, string[] instanceNames) { for (int i = 0; i < instanceNames.Length; i++) { instanceNames[i] = nameFormatter.CreateName(instanceNames[i]); } }
private void FormatCounterInstanceNames(IPerformanceCounterNameFormatter nameFormatter, string[] instanceNames) { for (int i = 0; i < instanceNames.Length; i++) { instanceNames[i] = nameFormatter.CreateName(instanceNames[i]); } }
public void SetUp() { nameFormatter = new FixedPrefixNameFormatter("Prefix - "); formattedInstanceName = nameFormatter.CreateName(instanceName); totalConnectionOpenedCounter = new EnterpriseLibraryPerformanceCounter( NewDataInstrumentationProvider.CounterCategoryName, NewDataInstrumentationProvider.TotalConnectionOpenedCounter, formattedInstanceName); totalConnectionFailedCounter = new EnterpriseLibraryPerformanceCounter( NewDataInstrumentationProvider.CounterCategoryName, NewDataInstrumentationProvider.TotalConnectionFailedCounter, formattedInstanceName); totalCommandsExecutedCounter = new EnterpriseLibraryPerformanceCounter( NewDataInstrumentationProvider.CounterCategoryName, NewDataInstrumentationProvider.TotalCommandsExecutedCounter, formattedInstanceName); totalCommandsFailedCounter = new EnterpriseLibraryPerformanceCounter( NewDataInstrumentationProvider.CounterCategoryName, NewDataInstrumentationProvider.TotalCommandsFailedCounter, formattedInstanceName); provider = new NewDataInstrumentationProvider(instanceName, true, true, nameFormatter); ClearExistingCounts(); }
/// <summary> /// Base constructor for <see cref="InstrumentationListener"></see>. /// </summary> /// <param name="instanceName">Unique name for this instance</param> /// <param name="performanceCountersEnabled">True if performance counter reporting is enabled</param> /// <param name="eventLoggingEnabled">True if event logging is enabled</param> /// <param name="nameFormatter">Creates unique name for each <see cref="PerformanceCounter"/> instance.</param> protected InstrumentationListener(string instanceName, bool performanceCountersEnabled, bool eventLoggingEnabled, IPerformanceCounterNameFormatter nameFormatter) : this(CreateDefaultInstanceNames(instanceName), performanceCountersEnabled, eventLoggingEnabled, nameFormatter) { }
/// <summary> /// Base constructor for <see cref="InstrumentationListener"></see>. /// </summary> /// <param name="instanceNames">Unique names for th <see cref="PerformanceCounter"></see> instances to be managed by this listener.</param> /// <param name="performanceCountersEnabled">True if performance counter reporting is enabled</param> /// <param name="eventLoggingEnabled">True if event logging is enabled</param> /// <param name="nameFormatter">Creates unique name for each <see cref="PerformanceCounter"/> instance.</param> protected InstrumentationListener(string[] instanceNames, bool performanceCountersEnabled, bool eventLoggingEnabled, IPerformanceCounterNameFormatter nameFormatter) { Initialize(performanceCountersEnabled, eventLoggingEnabled, nameFormatter, instanceNames); }
/// <summary> /// Initializes a new instance of the <see cref="ExceptionHandlingInstrumentationProvider"/> class. /// </summary> /// <param name="instanceName">The name of the <see cref="ExceptionPolicy"/> this instrumentation listener is bound to.</param> /// <param name="performanceCountersEnabled"><code>true</code> if performance counters should be updated.</param> /// <param name="eventLoggingEnabled"><code>true</code> if event log entries should be written.</param> /// <param name="nameFormatter">The <see cref="IPerformanceCounterNameFormatter"/> that is used to creates unique name for each <see cref="PerformanceCounter"/> instance.</param> public ExceptionHandlingInstrumentationProvider(string instanceName, bool performanceCountersEnabled, bool eventLoggingEnabled, IPerformanceCounterNameFormatter nameFormatter) : base(instanceName, performanceCountersEnabled, eventLoggingEnabled, nameFormatter) { this.instanceName = instanceName; }
/// <summary> /// Initializes a new instance of the <see cref="AuthorizationProviderInstrumentationProvider"/> class. /// </summary> /// <param name="instanceName">The name of the <see cref="AuthorizationProvider"/> instance the events apply on.</param> /// <param name="performanceCountersEnabled"><code>true</code> if performance counters should be updated.</param> /// <param name="eventLoggingEnabled"><code>true</code> if event log entries should be written.</param> /// <param name="nameFormatter">The <see cref="IPerformanceCounterNameFormatter"/> that is used to creates unique name for each <see cref="PerformanceCounter"/> instance.</param> public AuthorizationProviderInstrumentationProvider(string instanceName, bool performanceCountersEnabled, bool eventLoggingEnabled, IPerformanceCounterNameFormatter nameFormatter) : base(instanceName, performanceCountersEnabled, eventLoggingEnabled, nameFormatter) { this.instanceName = instanceName; }
/// <summary> /// Base constructor for <see cref="InstrumentationListener"></see>. /// </summary> /// <overloads> /// Base constructor for <see cref="InstrumentationListener"></see>. /// </overloads> /// <param name="performanceCountersEnabled">True if performance counter reporting is enabled</param> /// <param name="eventLoggingEnabled">True if event logging is enabled</param> /// <param name="wmiEnabled">True if WMI logging is enabled</param> /// <param name="nameFormatter">Creates unique name for each <see cref="PerformanceCounter"/> instance.</param> protected InstrumentationListener(bool performanceCountersEnabled, bool eventLoggingEnabled, bool wmiEnabled, IPerformanceCounterNameFormatter nameFormatter) { string[] instanceNames = new string[] { DefaultCounterName }; Initialize(performanceCountersEnabled, eventLoggingEnabled, wmiEnabled, nameFormatter, instanceNames); }
/// <summary> /// </summary> /// <param name="instanceName">The name of the <see cref="ISymmetricCryptoProvider"/> instance this instrumentation listener is created for.</param> /// <param name="performanceCountersEnabled"><b>true</b> if performance counters should be updated.</param> /// <param name="eventLoggingEnabled"><b>true</b> if event log entries should be written.</param> /// <param name="nameFormatter">The <see cref="IPerformanceCounterNameFormatter"/> that is used to creates unique name for each <see cref="PerformanceCounter"/> instance.</param> public SymmetricAlgorithmInstrumentationProvider(string instanceName, bool performanceCountersEnabled, bool eventLoggingEnabled, IPerformanceCounterNameFormatter nameFormatter) : base(instanceName, performanceCountersEnabled, eventLoggingEnabled, nameFormatter) { this.instanceName = instanceName; }
/// <summary> /// Initializes a new instance of the <see cref="SecurityCacheProviderInstrumentationListener"/> class. /// </summary> /// <param name="instanceName">The name of the <see cref="SecurityCacheProvider"/> instance the events apply on.</param> /// <param name="performanceCountersEnabled"><code>true</code> if performance counters should be updated.</param> /// <param name="eventLoggingEnabled"><code>true</code> if event log entries should be written.</param> /// <param name="wmiEnabled"><code>true</code> if WMI events should be fired.</param> /// <param name="nameFormatter">The <see cref="IPerformanceCounterNameFormatter"/> that is used to creates unique name for each <see cref="PerformanceCounter"/> instance.</param> public SecurityCacheProviderInstrumentationListener(string instanceName, bool performanceCountersEnabled, bool eventLoggingEnabled, bool wmiEnabled, IPerformanceCounterNameFormatter nameFormatter) : base(instanceName, performanceCountersEnabled, eventLoggingEnabled, wmiEnabled, nameFormatter) { this.instanceName = instanceName; }
/// <summary> /// Initializes a new instance of the <see cref="SecurityCacheProviderInstrumentationListener"/> class. /// </summary> /// <param name="instanceName">The name of the <see cref="SecurityCacheProvider"/> instance the events apply on.</param> /// <param name="performanceCountersEnabled"><code>true</code> if performance counters should be updated.</param> /// <param name="eventLoggingEnabled"><code>true</code> if event log entries should be written.</param> /// <param name="wmiEnabled"><code>true</code> if WMI events should be fired.</param> /// <param name="nameFormatter">The <see cref="IPerformanceCounterNameFormatter"/> that is used to creates unique name for each <see cref="PerformanceCounter"/> instance.</param> public SecurityCacheProviderInstrumentationListener(string instanceName, bool performanceCountersEnabled, bool eventLoggingEnabled, bool wmiEnabled, IPerformanceCounterNameFormatter nameFormatter) : base(instanceName, performanceCountersEnabled, eventLoggingEnabled, wmiEnabled, nameFormatter) { this.instanceName = instanceName; }
/// <summary> /// Initializes a new instance of the <see cref="HashAlgorithmInstrumentationListener"/> class. /// </summary> /// <param name="instanceName">The name of the <see cref="IHashProvider"/> instance this instrumentation listener is created for.</param> /// <param name="performanceCountersEnabled"><b>true</b> if performance counters should be updated.</param> /// <param name="eventLoggingEnabled"><b>true</b> if event log entries should be written.</param> /// <param name="wmiEnabled"><b>true</b> if WMI events should be fired.</param> /// <param name="nameFormatter">The <see cref="IPerformanceCounterNameFormatter"/> that is used to creates unique name for each <see cref="PerformanceCounter"/> instance.</param> public HashAlgorithmInstrumentationListener(string instanceName, bool performanceCountersEnabled, bool eventLoggingEnabled, bool wmiEnabled, IPerformanceCounterNameFormatter nameFormatter) : base(instanceName, performanceCountersEnabled, eventLoggingEnabled, wmiEnabled, nameFormatter) { this.instanceName = instanceName; }
/// <summary> /// Initializes a new instance of the <see cref="HashAlgorithmInstrumentationListener"/> class. /// </summary> /// <param name="instanceName">The name of the <see cref="IHashProvider"/> instance this instrumentation listener is created for.</param> /// <param name="performanceCountersEnabled"><b>true</b> if performance counters should be updated.</param> /// <param name="eventLoggingEnabled"><b>true</b> if event log entries should be written.</param> /// <param name="wmiEnabled"><b>true</b> if WMI events should be fired.</param> /// <param name="nameFormatter">The <see cref="IPerformanceCounterNameFormatter"/> that is used to creates unique name for each <see cref="PerformanceCounter"/> instance.</param> public HashAlgorithmInstrumentationListener(string instanceName, bool performanceCountersEnabled, bool eventLoggingEnabled, bool wmiEnabled, IPerformanceCounterNameFormatter nameFormatter) : base(instanceName, performanceCountersEnabled, eventLoggingEnabled, wmiEnabled, nameFormatter) { this.instanceName = instanceName; }
public void SetUp() { nameFormatter = new FixedPrefixNameFormatter("Prefix - "); listener = new DataInstrumentationListener(instanceName, true, true, true, nameFormatter); formattedInstanceName = nameFormatter.CreateName(instanceName); totalConnectionOpenedCounter = new EnterpriseLibraryPerformanceCounter(counterCategoryName, TotalConnectionOpenedCounter, formattedInstanceName); totalConnectionFailedCounter = new EnterpriseLibraryPerformanceCounter(counterCategoryName, TotalConnectionFailedCounter, formattedInstanceName); totalCommandsExecutedCounter = new EnterpriseLibraryPerformanceCounter(counterCategoryName, TotalCommandsExecutedCounter, formattedInstanceName); totalCommandsFailedCounter = new EnterpriseLibraryPerformanceCounter(counterCategoryName, TotalCommandsFailedCounter, formattedInstanceName); }
/// <summary> /// Initializes a new instance of the <see cref="CachingInstrumentationProvider"/> class. /// </summary> /// <param name="instanceName">The name of the <see cref="CacheManager"/> instance this instrumentation listener is created for.</param> /// <param name="performanceCountersEnabled"><b>true</b> if performance counters should be updated.</param> /// <param name="eventLoggingEnabled"><b>true</b> if event log entries should be written.</param> /// <param name="nameFormatter">The <see cref="IPerformanceCounterNameFormatter"/> that is used to creates unique name for each <see cref="PerformanceCounter"/> instance.</param> public CachingInstrumentationProvider(string instanceName, bool performanceCountersEnabled, bool eventLoggingEnabled, IPerformanceCounterNameFormatter nameFormatter) : base(new[] { instanceName }, performanceCountersEnabled, eventLoggingEnabled, nameFormatter) { this.instanceName = instanceName; counterInstanceName = CreateInstanceName(instanceName); eventLogEntryFormatter = new EventLogEntryFormatter(Resources.BlockName); }
/// <summary> /// Initializes a new instance of the <see cref="CachingInstrumentationListener"/> class. /// </summary> /// <param name="instanceName">The name of the <see cref="CacheManager"/> instance this instrumentation listener is created for.</param> /// <param name="performanceCountersEnabled"><b>true</b> if performance counters should be updated.</param> /// <param name="eventLoggingEnabled"><b>true</b> if event log entries should be written.</param> /// <param name="wmiEnabled"><b>true</b> if WMI events should be fired.</param> /// <param name="nameFormatter">The <see cref="IPerformanceCounterNameFormatter"/> that is used to creates unique name for each <see cref="PerformanceCounter"/> instance.</param> public CachingInstrumentationListener(string instanceName, bool performanceCountersEnabled, bool eventLoggingEnabled, bool wmiEnabled, IPerformanceCounterNameFormatter nameFormatter) : base(new string[] { instanceName }, performanceCountersEnabled, eventLoggingEnabled, wmiEnabled, nameFormatter) { this.instanceName = instanceName; this.counterInstanceName = CreateInstanceName(instanceName); this.eventLogEntryFormatter = new EventLogEntryFormatter(Resources.BlockName); }
private void Initialize(bool performanceCountersEnabled, bool eventLoggingEnabled, bool wmiEnabled, IPerformanceCounterNameFormatter nameFormatter, string[] instanceNames) { this.performanceCountersEnabled = performanceCountersEnabled; this.eventLoggingEnabled = eventLoggingEnabled; this.wmiEnabled = wmiEnabled; this.nameFormatter = nameFormatter; if (performanceCountersEnabled) { this.FormatCounterInstanceNames(nameFormatter, instanceNames); this.CreatePerformanceCounters(instanceNames); } }
private void Initialize(bool performanceCountersEnabled, bool eventLoggingEnabled, IPerformanceCounterNameFormatter nameFormatter, string[] instanceNames) { this.performanceCountersEnabled = performanceCountersEnabled; this.eventLoggingEnabled = eventLoggingEnabled; this.nameFormatter = nameFormatter; if (performanceCountersEnabled) { FormatCounterInstanceNames(nameFormatter, instanceNames); CreatePerformanceCounters(instanceNames); } }
public void SetUp() { var handlers = new IExceptionHandler[] { new MockThrowingExceptionHandler() }; var instrumentationProvider = new ExceptionHandlingInstrumentationProvider(policyName, true, true, "ApplicationInstanceName"); var policyEntry = new ExceptionPolicyEntry(typeof(ArgumentException), PostHandlingAction.None, handlers, instrumentationProvider); var policyEntries = new Dictionary<Type, ExceptionPolicyEntry> { {typeof (ArgumentException), policyEntry} }; exceptionPolicy = new ExceptionPolicyImpl(policyName, policyEntries); nameFormatter = new FixedPrefixNameFormatter("Prefix - "); provider = new ExceptionHandlingInstrumentationProvider(instanceName, true, true, nameFormatter); formattedInstanceName = nameFormatter.CreateName(instanceName); totalExceptionHandlersExecuted = new EnterpriseLibraryPerformanceCounter(counterCategoryName, TotalExceptionHandlersExecuted, formattedInstanceName); totalExceptionsHandled = new EnterpriseLibraryPerformanceCounter(counterCategoryName, TotalExceptionsHandled, formattedInstanceName); }
public void SetUp() { var handlers = new IExceptionHandler[] { new MockThrowingExceptionHandler() }; var instrumentationProvider = new ExceptionHandlingInstrumentationProvider(policyName, true, true, "ApplicationInstanceName"); var policyEntry = new ExceptionPolicyEntry(typeof(ArgumentException), PostHandlingAction.None, handlers, instrumentationProvider); var policyEntries = new Dictionary <Type, ExceptionPolicyEntry> { { typeof(ArgumentException), policyEntry } }; exceptionPolicy = new ExceptionPolicyImpl(policyName, policyEntries); nameFormatter = new FixedPrefixNameFormatter("Prefix - "); provider = new ExceptionHandlingInstrumentationProvider(instanceName, true, true, nameFormatter); formattedInstanceName = nameFormatter.CreateName(instanceName); totalExceptionHandlersExecuted = new EnterpriseLibraryPerformanceCounter(counterCategoryName, TotalExceptionHandlersExecuted, formattedInstanceName); totalExceptionsHandled = new EnterpriseLibraryPerformanceCounter(counterCategoryName, TotalExceptionsHandled, formattedInstanceName); }
public void SetUp() { IExceptionHandler[] handlers = new IExceptionHandler[] { new MockThrowingExceptionHandler() }; ExceptionPolicyEntry policyEntry = new ExceptionPolicyEntry(PostHandlingAction.None, handlers); Dictionary <Type, ExceptionPolicyEntry> policyEntries = new Dictionary <Type, ExceptionPolicyEntry>(); policyEntries.Add(typeof(ArgumentException), policyEntry); exceptionPolicy = new ExceptionPolicyImpl(policyName, policyEntries); ReflectionInstrumentationAttacher attacher = new ReflectionInstrumentationAttacher( exceptionPolicy.GetInstrumentationEventProvider(), typeof(ExceptionHandlingInstrumentationListener), new object[] { policyName, true, true, true, "ApplicationInstanceName" }); attacher.BindInstrumentation(); nameFormatter = new FixedPrefixNameFormatter("Prefix - "); listener = new ExceptionHandlingInstrumentationListener(instanceName, true, true, true, nameFormatter); formattedInstanceName = nameFormatter.CreateName(instanceName); totalExceptionHandlersExecuted = new EnterpriseLibraryPerformanceCounter(counterCategoryName, TotalExceptionHandlersExecuted, formattedInstanceName); totalExceptionsHandled = new EnterpriseLibraryPerformanceCounter(counterCategoryName, TotalExceptionsHandled, formattedInstanceName); }
/// <summary> /// Initializes a new instance of the <see cref="ValidationInstrumentationListener"/> class. /// </summary> /// <param name="performanceCountersEnabled"><code>true</code> if performance counters should be updated.</param> /// <param name="eventLoggingEnabled"><code>true</code> if event log entries should be written.</param> /// <param name="wmiEnabled"><code>true</code> if WMI events should be fired.</param> /// <param name="nameFormatter">Creates unique name for each <see cref="PerformanceCounter"/> instance.</param> public ValidationInstrumentationListener(bool performanceCountersEnabled, bool eventLoggingEnabled, bool wmiEnabled, IPerformanceCounterNameFormatter nameFormatter) : base(performanceCountersEnabled, eventLoggingEnabled, wmiEnabled, nameFormatter) { this.eventLogEntryFormatter = new EventLogEntryFormatter(Resources.BlockName); }
/// <summary> /// Base constructor for <see cref="InstrumentationListener"></see>. /// </summary> /// <param name="instanceNames">Unique names for th <see cref="PerformanceCounter"></see> instances to be managed by this listener.</param> /// <param name="performanceCountersEnabled">True if performance counter reporting is enabled</param> /// <param name="eventLoggingEnabled">True if event logging is enabled</param> /// <param name="wmiEnabled">True if WMI logging is enabled</param> /// <param name="nameFormatter">Creates unique name for each <see cref="PerformanceCounter"/> instance.</param> protected InstrumentationListener(string[] instanceNames, bool performanceCountersEnabled, bool eventLoggingEnabled, bool wmiEnabled, IPerformanceCounterNameFormatter nameFormatter) { Initialize(performanceCountersEnabled, eventLoggingEnabled, wmiEnabled, nameFormatter, instanceNames); }