internal static List <TelemetryItem> Convert(Batch <Activity> batchActivity, Resource resource, string instrumentationKey) { List <TelemetryItem> telemetryItems = new List <TelemetryItem>(); TelemetryItem telemetryItem; foreach (var activity in batchActivity) { MonitorBase telemetryData = new MonitorBase(); var monitorTags = EnumerateActivityTags(activity); telemetryItem = TelemetryPartA.GetTelemetryItem(activity, ref monitorTags, resource, instrumentationKey); switch (activity.GetTelemetryType()) { case TelemetryType.Request: telemetryData.BaseType = Telemetry_Base_Type_Mapping[TelemetryType.Request]; telemetryData.BaseData = TelemetryPartB.GetRequestData(activity, ref monitorTags); break; case TelemetryType.Dependency: telemetryData.BaseType = Telemetry_Base_Type_Mapping[TelemetryType.Dependency]; telemetryData.BaseData = TelemetryPartB.GetRemoteDependencyData(activity, ref monitorTags); break; } telemetryItem.Data = telemetryData; telemetryItems.Add(telemetryItem); } return(telemetryItems); }
internal static List <TelemetryItem> Convert(Batch <LogRecord> batchLogRecord, string instrumentationKey) { List <TelemetryItem> telemetryItems = new List <TelemetryItem>(); TelemetryItem telemetryItem; foreach (var logRecord in batchLogRecord) { telemetryItem = TelemetryPartA.GetTelemetryItem(logRecord, instrumentationKey); telemetryItem.Data = new MonitorBase { BaseType = Telemetry_Base_Type_Mapping[TelemetryType.Message], BaseData = TelemetryPartB.GetMessageData(logRecord), }; telemetryItems.Add(telemetryItem); } return(telemetryItems); }