Esempio n. 1
0
        public FileObjectCollection PopulateCollection <T>(FileObject fileObject) where T : IRecord
        {
            FileObjectCollection collection = new FileObjectCollection()
            {
                fileObject
            };

            _instance.TotalFilesFormatted++;
            _instance.TotalRecords += fileObject.RecordCount;

            if (_config.IsKustoConfigured())
            {
                // kusto native format is Csv
                // kusto json ingest is 2 to 3 times slower and does *not* use standard json format. uses json document per line no comma
                // using csv and compression for best performance
                collection = SerializeCsv <T>(fileObject);

                if (_config.KustoCompressed)
                {
                    collection.ForEach(x => x.Stream.Compress());
                }
            }
            else if (_config.IsLogAnalyticsConfigured())
            {
                // la is kusto based but only accepts non compressed json format ingest
                collection = SerializeJson <T>(fileObject);
            }

            collection.ForEach(x => SaveToCache(x));
            return(collection);
        }