Example #1
0
        public static List <EtlInMemoryProducerWorker.ProviderInfo> InitializeProviders(
            string etlPath,
            string etlFilePatterns,
            WinFabricEtlType fabricEtlType,
            Action <string> onValidationError)
        {
            if (!string.IsNullOrEmpty(etlPath))
            {
                return(InitializeProviderInfo(
                           etlFilePatterns,
                           onValidationError));
            }

            switch (fabricEtlType)
            {
            case WinFabricEtlType.QueryEtl:
                return(new List <EtlInMemoryProducerWorker.ProviderInfo>(QueryProviders));

            case WinFabricEtlType.OperationalEtl:
                return(new List <EtlInMemoryProducerWorker.ProviderInfo>(OperationalProviders));

            default:
                return(new List <EtlInMemoryProducerWorker.ProviderInfo>(DefaultProviders));
            }
        }
        public static string InitializeMarkerFileDirectory(
            bool isReadingFromApplicationManifest,
            string etlPath,
            string logDirectory,
            WinFabricEtlType fabricEtlType,
            string traceDirectory,
            string producerInstanceId)
        {
            if (isReadingFromApplicationManifest)
            {
                return(Path.Combine(
                           traceDirectory,
                           producerInstanceId,
                           EtlProducerConstants.MarkerFileDirectory));
            }

            if (!string.IsNullOrEmpty(etlPath))
            {
                return(Path.Combine(
                           traceDirectory,
                           EtlProducerConstants.MarkerFileDirectory));
            }

            return(Path.Combine(logDirectory, GetMarkerFileDirectory(fabricEtlType)));
        }
 public EtlProducerSettings(
     bool enabled,
     TimeSpan etlReadInterval,
     TimeSpan etlDeletionAgeMinutes,
     WinFabricEtlType serviceFabricEtlType,
     string etlPath,
     string etlFilePatterns,
     List <string> customManifestPaths,
     Dictionary <string, List <ServiceEtwManifestInfo> > serviceEtwManifests,
     bool processingWinFabEtlFiles,
     IEnumerable <Guid> appEtwGuids,
     string applicationType)
 {
     this.enabled                  = enabled;
     this.etlReadInterval          = etlReadInterval;
     this.etlDeletionAgeMinutes    = etlDeletionAgeMinutes;
     this.serviceFabricEtlType     = serviceFabricEtlType;
     this.etlPath                  = etlPath;
     this.etlFilePatterns          = etlFilePatterns;
     this.customManifestPaths      = customManifestPaths;
     this.serviceEtwManifests      = serviceEtwManifests;
     this.processingWinFabEtlFiles = processingWinFabEtlFiles;
     this.appEtwGuids              = appEtwGuids;
     this.applicationType          = applicationType;
 }
 public EtlInMemoryProducerValidator()
 {
     this.etlType         = WinFabricEtlType.Unspecified;
     this.settingHandlers = new Dictionary <string, Handler>()
     {
         {
             EtlInMemoryProducerConstants.EtlReadIntervalParamName,
             new Handler()
             {
                 Validator = this.ValidateEtlReadIntervalSetting
             }
         },
         {
             EtlInMemoryProducerConstants.DataDeletionAgeParamName,
             new Handler()
             {
                 Validator = this.ValidateLogDeletionAgeSetting
             }
         },
         {
             EtlInMemoryProducerConstants.WindowsFabricEtlTypeParamName,
             new Handler()
             {
                 Validator = this.ValidateEtlTypeSetting
             }
         },
         {
             EtlInMemoryProducerConstants.TestDataDeletionAgeParamName,
             new Handler()
             {
                 Validator = this.ValidateLogDeletionAgeTestSetting
             }
         },
         {
             EtlInMemoryProducerConstants.TestEtlPathParamName,
             new Handler()
             {
                 Validator = this.ValidateEtlPath
             }
         },
         {
             EtlInMemoryProducerConstants.TestEtlFilePatternsParamName,
             new Handler()
             {
                 Validator = this.ValidateEtlFilePatterns
             }
         },
         {
             EtlInMemoryProducerConstants.TestProcessingWinFabEtlFilesParamName,
             new Handler()
             {
                 Validator = this.ValidateProcessingWinFabEtlFilesSetting
             }
         }
     };
     this.encryptedSettingHandlers = new Dictionary <string, Handler>();
     return;
 }
Example #5
0
        public static string InitializeTraceDirectory(
            string etlPath,
            string logDirectory,
            WinFabricEtlType fabricEtlType)
        {
            if (!string.IsNullOrEmpty(etlPath))
            {
                return(etlPath);
            }

            return(Path.Combine(logDirectory, GetTracesSubDirectory(fabricEtlType)));
        }
Example #6
0
        internal EtlProcessor(
            bool loadWinFabManifests,
            bool dynamicWinFabManifestLoad,
            IEnumerable <string> customManifestPaths,
            string applicationType,
            string markerFileDirectory,
            WinFabricEtlType winFabricEtlType,
            FabricEvents.ExtensionsEvents traceSource,
            string logSourceId,
            EtlPerformance perfHelper,
            IEnumerable <IEtlFileSink> sinks,
            IEnumerable <EtlToCsvFileWriter> etlToCsvFileWriters,
            IEnumerable <BufferedEtwEventProvider> bufferedEtwEventProviders,
            IEnumerable <Guid> appEtwGuids,
            ITraceFileEventReaderFactory traceFileEventReaderFactory)
        {
            this.traceSource            = traceSource;
            this.logSourceId            = logSourceId;
            this.processingWinFabEvents = loadWinFabManifests;
            this.applicationType        = applicationType;
            this.markerFileDirectory    = markerFileDirectory;
            this.windowsFabricEtlType   = winFabricEtlType;
            this.perfHelper             = perfHelper;
            this.sinks = sinks.ToList().AsReadOnly();
            this.etlToCsvFileWriters       = etlToCsvFileWriters.ToList().AsReadOnly();
            this.bufferedEtwEventProviders = bufferedEtwEventProviders.ToList().AsReadOnly();
            this.appEtwGuids = appEtwGuids != null?appEtwGuids.ToList().AsReadOnly() : null;

            this.traceFileEventReaderFactory = traceFileEventReaderFactory;

            // Load the custom manifests (if any) into the manifest cache
            this.LoadManifests(customManifestPaths);

            if (loadWinFabManifests)
            {
                if (dynamicWinFabManifestLoad)
                {
                    // We are going to be loading manifests dynamically based on the version
                    // in the ETL file. Initialize the manifest manager object to manage this
                    // for us.
                    this.winFabManifestMgr = this.InitializeWinFabManifestManager();
                }
                else
                {
                    // We'll load the default manifests now and just use them throughout
                    this.LoadDefaultManifests();
                }
            }

            // Provide the sinks a reference to the manifest cache.
            this.OnEtwManifestCacheAvailable();
        }
        public static string InitializeTraceDirectory(
            bool isReadingFromApplicationManifest,
            string etlPath,
            string logDirectory,
            WinFabricEtlType fabricEtlType)
        {
            if (isReadingFromApplicationManifest || !string.IsNullOrEmpty(etlPath))
            {
                return(etlPath);
            }

            return(Path.Combine(logDirectory, GetTracesSubDirectory(fabricEtlType)));
        }
        private static string GetMarkerFileDirectory(WinFabricEtlType fabricEtlType)
        {
            switch (fabricEtlType)
            {
            case WinFabricEtlType.QueryEtl:
                return(EtlProducerConstants.QueryMarkerFileDirectory);

            case WinFabricEtlType.OperationalEtl:
                return(EtlProducerConstants.OperationalMarkerFileDirectory);

            default:
                return(EtlProducerConstants.MarkerFileDirectory);
            }
        }
        private static string GetTracesSubDirectory(WinFabricEtlType fabricEtlType)
        {
            switch (fabricEtlType)
            {
            case WinFabricEtlType.QueryEtl:
                return(EtlProducerConstants.QueryTracesDirectory);

            case WinFabricEtlType.OperationalEtl:
                return(EtlProducerConstants.OperationalTracesDirectory);

            default:
                return(EtlProducerConstants.TracesDirectory);
            }
        }
Example #10
0
        public static string InitializeMarkerFileDirectory(
            string etlPath,
            string logDirectory,
            string traceDirectory,
            WinFabricEtlType fabricEtlType)
        {
            if (!string.IsNullOrEmpty(etlPath))
            {
                return(Path.Combine(
                           traceDirectory,
                           EtlInMemoryProducerConstants.MarkerFileDirectory));
            }

            return(Path.Combine(logDirectory, GetMarkerFileDirectory(fabricEtlType)));
        }
        private bool ValidateEtlTypeSetting()
        {
            string etlTypeAsString;
            string etlParameterName;

            if (this.parameters.ContainsKey(EtlInMemoryProducerConstants.WindowsFabricEtlTypeParamName))
            {
                etlTypeAsString  = this.parameters[EtlInMemoryProducerConstants.WindowsFabricEtlTypeParamName];
                etlParameterName = EtlInMemoryProducerConstants.WindowsFabricEtlTypeParamName;
            }
            else
            {
                etlTypeAsString  = this.parameters[EtlInMemoryProducerConstants.ServiceFabricEtlTypeParamName];
                etlParameterName = EtlInMemoryProducerConstants.ServiceFabricEtlTypeParamName;
            }

            if (etlTypeAsString.Equals(
                    EtlInMemoryProducerConstants.DefaultEtl,
                    StringComparison.Ordinal))
            {
                this.etlType = WinFabricEtlType.DefaultEtl;
                return(true);
            }
            else if (etlTypeAsString.Equals(
                         EtlInMemoryProducerConstants.QueryEtl,
                         StringComparison.Ordinal))
            {
                this.etlType = WinFabricEtlType.QueryEtl;
                return(true);
            }
            else if (etlTypeAsString.Equals(
                         EtlInMemoryProducerConstants.OperationalEtl,
                         StringComparison.Ordinal))
            {
                this.etlType = WinFabricEtlType.OperationalEtl;
                return(true);
            }
            else
            {
                this.traceSource.WriteError(
                    this.logSourceId,
                    "The ETL type '{0}' specified in section {1}, parameter {2} is not supported.",
                    etlTypeAsString,
                    this.sectionName,
                    etlParameterName);
                return(false);
            }
        }
 public EtlInMemoryProducerSettings(
     bool enabled,
     TimeSpan etlReadInterval,
     TimeSpan etlDeletionAgeMinutes,
     WinFabricEtlType serviceFabricEtlType,
     string etlPath,
     string etlFilePatterns,
     bool processingWinFabEtlFiles)
 {
     this.enabled                  = enabled;
     this.etlReadInterval          = etlReadInterval;
     this.etlDeletionAgeMinutes    = etlDeletionAgeMinutes;
     this.serviceFabricEtlType     = serviceFabricEtlType;
     this.etlPath                  = etlPath;
     this.etlFilePatterns          = etlFilePatterns;
     this.processingWinFabEtlFiles = processingWinFabEtlFiles;
 }
Example #13
0
        internal EtlProcessor(
            bool loadWinFabManifests,
            bool dynamicWinFabManifestLoad,
            string markerFileDirectory,
            WinFabricEtlType winFabricEtlType,
            FabricEvents.ExtensionsEvents traceSource,
            string logSourceId,
            EtlInMemoryPerformance perfHelper,
            IEnumerable <IEtlInMemorySink> sinks,
            IEnumerable <EtlToInMemoryBufferWriter> etlToInMemoryBufferWriters,
            ITraceFileEventReaderFactory traceFileEventReaderFactory)
        {
            this.traceSource            = traceSource;
            this.logSourceId            = logSourceId;
            this.processingWinFabEvents = loadWinFabManifests;
            this.markerFileDirectory    = markerFileDirectory;
            this.windowsFabricEtlType   = winFabricEtlType;
            this.sinks = sinks.ToList().AsReadOnly();
            this.etlToInMemoryBufferWriters  = etlToInMemoryBufferWriters.ToList().AsReadOnly();
            this.traceFileEventReaderFactory = traceFileEventReaderFactory;
            this.perfHelper = perfHelper;

            if (loadWinFabManifests)
            {
                if (dynamicWinFabManifestLoad)
                {
                    // We are going to be loading manifests dynamically based on the version
                    // in the ETL file. Initialize the manifest manager object to manage this
                    // for us.
                    this.winFabManifestMgr = this.InitializeWinFabManifestManager();
                }
                else
                {
                    // We'll load the default manifests now and just use them throughout
                    this.LoadDefaultManifests();
                }
            }

            // Provide the sinks a reference to the manifest cache.
            this.sinks.ForEach(sink => sink.SetEtwManifestCache(this.etwManifestCache));
        }