public static PerfCounterFolderProcessor Create( FabricEvents.ExtensionsEvents traceSource, string logSourceId, ConfigReader configReader, string logDirectory, string outputFolderPath, out bool isEnabled, out List <string> additionalFoldersToTrim) { additionalFoldersToTrim = null; isEnabled = false; // Create a new instance of the folder processor PerfCounterFolderProcessor folderProcessor = new PerfCounterFolderProcessor(); // PerfCounterFolderProcessor is a singleton, so make sure there are no other instances. object original = Interlocked.CompareExchange(ref folderProcessorSingleton, folderProcessor, null); if (null != original) { traceSource.WriteError( logSourceId, "Cannot have more than one producer of type {0}, whose {1} value is {2}.", StandardPluginTypes.FolderProducer, FolderProducerValidator.FolderTypeParamName, FolderProducerValidator.ServiceFabricPerformanceCounters); return(null); } // Initialize the folder processor if (false == folderProcessor.Initialize(traceSource, logSourceId, configReader, logDirectory, outputFolderPath)) { return(null); } isEnabled = folderProcessor.perfCounterCollectionEnabled; if (isEnabled) { // In addition to the output folder, which is already trimmed by default, we also need // the perf counter binary folder and the perf counter binary archive folder to be trimmed. additionalFoldersToTrim = new List <string> { folderProcessor.perfCounterBinaryFolder }; if (false == folderProcessor.archiveFolderIsUnderBinaryFolder) { additionalFoldersToTrim.Add(folderProcessor.perfCounterBinaryArchiveFolder); } } return(folderProcessor); }