Exemple #1
0
        /// <summary>
        /// Gets the schema from a sample data generated within 30 seconds as default
        /// </summary>
        /// <param name="storageConnectionString">storageConnectionString</param>
        /// <param name="samplesPath">samplesPath</param>
        /// <param name="userId">userId</param>
        /// <param name="flowId">flowId</param>
        /// <param name="seconds">seconds is the duration of time</param>
        /// <returns>Returns ApiResult with schema Result object</returns>
        public async Task <SchemaResult> GetSchemaAsync(string storageConnectionString, string samplesPath, string userId, string flowId, int seconds = _DefaultDuration)
        {
            // Get sample events
            EventsData eventsData = await GetSampleEvents(seconds);

            List <EventRaw> events = eventsData.Events;

            _logger.LogInformation($"Event count = {events.Count}");

            if (events.Count < 1)
            {
                throw new Exception("Can't capture any data from the data source.");
            }

            // Save sample events
            SaveSample(storageConnectionString, samplesPath, userId, flowId, eventsData.EventsJson);
            _logger.LogInformation($"successful save to {samplesPath}");
            // Get schema

            //log schemaResult.schema.length and count of errors
            SchemaResult schemaResult = GetSchemaHelper(events);

            _logger.LogInformation($"schemaResult.schema.length: {schemaResult.Schema.Length} and count of errors: {schemaResult.Errors.Count}");
            return(schemaResult);
        }
Exemple #2
0
        /// <summary>
        /// RefreshSample
        /// </summary>
        /// <param name="storageConnectionString">storageConnectionString</param>
        /// <param name="samplesPath">samplesPath</param>
        /// <param name="userId">userId</param>
        /// <param name="flowId">flowId</param>
        /// <param name="seconds">seconds is duration of time for the sample</param>
        /// <returns>void</returns>
        public async Task RefreshSample(string storageConnectionString, string samplesPath, string userId, string flowId, int seconds = _DefaultDuration)
        {
            // Get sample events
            EventsData eventsData = await GetSampleEvents(seconds);

            List <EventRaw> events = eventsData.Events;

            _logger.LogInformation($"RefreshSample: events.Count = {events.Count}");

            if (events.Count < 1)
            {
                throw new Exception("Can't capture any data from the data source.");
            }

            // Save sample events
            SaveSample(storageConnectionString, samplesPath, userId, flowId, eventsData.EventsJson);
        }
 public EventProcessor(ref EventsData eventsData)
 {
     _eventsData = eventsData;
 }
Exemple #4
0
 public EventProcessorFactory()
 {
     EventsData = new EventsData();
 }