コード例 #1
0
 /// <summary>
 /// Export a CSV file for each instance of am EventMetric
 /// </summary>
 private void ExportEventMetric(ISession session, IEventMetricDefinition metricDefinition, ref int metricFileCount)
 {
     if (metricDefinition.Metrics.Count == 1)
     {
         try
         {
             using (
                 var writer = StreamCreator.CreateMetricStream(_context, Config, session, metricDefinition,
                                                               ref metricFileCount))
             {
                 ExportEventSamples(writer, metricDefinition, metricDefinition.Metrics[0] as IEventMetric);
             }
         }
         catch (Exception ex)
         {
             _context.Log.RecordException(ex, LogCategory, true);
         }
     }
     else
     {
         foreach (var metric in metricDefinition.Metrics)
         {
             try
             {
                 using (
                     var writer = StreamCreator.CreateMetricInstanceStream(_context, Config, session, metric,
                                                                           ref metricFileCount))
                 {
                     ExportEventSamples(writer, metricDefinition, metric as IEventMetric);
                 }
             }
             catch (Exception ex)
             {
                 _context.Log.RecordException(ex, LogCategory, true);
             }
         }
     }
 }