コード例 #1
0
 void ITelemetryWriter.PushTelemetry(TelemetryCollection telemetryCollection)
 {
     // sending all other events from telemetryCollection
     foreach (var telEvent in AppInsightsTelemetryWriter.GetEventTelemetryList(telemetryCollection))
     {
         this.telemetryClient.TrackEvent(telEvent);
     }
 }
コード例 #2
0
        // extension to create AppInsights EventTelemetry list from  a TelemetryCollection
        public static List <EventTelemetry> GetEventTelemetryList(TelemetryCollection telemetryCollection)
        {
            List <EventTelemetry> eventTelemetryList = new List <EventTelemetry>();

            foreach (TraceAggregator traceAggregator in telemetryCollection)
            {
                eventTelemetryList.Add(AppInsightsTelemetryWriter.ConvertAggregationToTelemetry(traceAggregator.TraceAggrConfig, traceAggregator, telemetryCollection.TelemetryIds, telemetryCollection.DailyNumberOfTelemetryPushes, telemetryCollection.TelemetryBatchNumber));
            }

            return(eventTelemetryList);
        }
コード例 #3
0
        private static EventTelemetry ConvertAggregationToTelemetry(TraceAggregationConfig traceAggregationConfig, TraceAggregator traceAggregator, TelemetryIdentifiers telemetryIds, int telBatchesDaily, int telBatchNumber)
        {
            EventTelemetry eventEntity = AppInsightsTelemetryWriter.CreateBaseEventTelemetry(telemetryIds, traceAggregationConfig.TaskName, traceAggregationConfig.EventName, telBatchesDaily, telBatchNumber, traceAggregator.TraceTimestamp);

            Dictionary <string, string> properties;
            Dictionary <string, double> metrics;

            traceAggregator.CurrentFormattedFieldAggregationsValues(out properties, out metrics);

            foreach (var property in properties)
            {
                eventEntity.Properties[property.Key] = property.Value;
            }

            foreach (var metric in metrics)
            {
                eventEntity.Metrics[metric.Key] = metric.Value;
            }

            return(eventEntity);
        }