/// <summary> /// Constructors -- Registers Orleans system performance counters, /// plus any grain-specific activation counters that can be detected when this installer is run. /// </summary> public OrleansPerformanceCounterInstaller() { Trace.Listeners.Clear(); var loggerFactory = CreateDefaultLoggerFactory($"{this.GetType()}.log"); var parts = new ApplicationPartManager(); parts.ConfigureDefaults().AddFeatureProvider(new AssemblyAttributeFeatureProvider <GrainClassFeature>()); var grainClassFeature = parts.CreateAndPopulateFeature <GrainClassFeature>(); CrashUtils.GrainTypes = grainClassFeature.Classes.Select(metadata => TypeUtils.GetFullName(metadata.ClassType)).ToList(); consumer = new OrleansPerfCounterTelemetryConsumer(loggerFactory); this.logger = loggerFactory.CreateLogger <OrleansPerformanceCounterInstaller>(); }
public CounterControl(ILoggerFactory loggerFactory) { // Check user is Administrator and has granted UAC elevation permission to run this app var userIdent = WindowsIdentity.GetCurrent(); var userPrincipal = new WindowsPrincipal(userIdent); IsRunningAsAdministrator = userPrincipal.IsInRole(WindowsBuiltInRole.Administrator); var parts = new ApplicationPartManager(); parts.ConfigureDefaults() .AddFeatureProvider(new AssemblyAttributeFeatureProvider <GrainClassFeature>()); var grainClassFeature = parts.CreateAndPopulateFeature <GrainClassFeature>(); CrashUtils.GrainTypes = grainClassFeature.Classes.Select(metadata => TypeUtils.GetFullName(metadata.ClassType)).ToList(); perfCounterConsumer = new OrleansPerfCounterTelemetryConsumer(loggerFactory); this.logger = loggerFactory.CreateLogger <CounterControl>(); }