Exemple #1
0
        public static TraceTelemetry ConvertTraceToSdkApi(Telemetry inputTelemetry)
        {
            var result = new TraceTelemetry();

            result.Message = inputTelemetry.Message.Message_;

            result.SeverityLevel = AiTelemetryConverter.ConvertSeverityLevel(inputTelemetry.Message.SeverityLevel);

            result.Properties.PopulateFromProtobuf(inputTelemetry.Message.Properties);

            AiTelemetryConverter.CopyCommonFields(inputTelemetry, result);
            AiTelemetryConverter.CopySamplingFields(inputTelemetry, result);

            return(result);
        }
Exemple #2
0
        public static ExceptionTelemetry ConvertExceptionToSdkApi(Telemetry inputTelemetry)
        {
            //!!! make sure we're onboarded onto a release version of AI SDK
            var item = inputTelemetry.Exception;

            var result = new ExceptionTelemetry(
                item.Exceptions.Select(ed => new ExceptionDetailsInfo(ed.Id, ed.OuterId, ed.TypeName, ed.Message, ed.HasFullStack?.Value ?? true, ed.Stack,
                                                                      ed.ParsedStack.Select(f => new Microsoft.ApplicationInsights.DataContracts.StackFrame(f.Assembly, f.FileName, f.Level, f.Line, f.Method)))),
                AiTelemetryConverter.ConvertSeverityLevel(item.SeverityLevel), item.ProblemId, item.Properties, item.Measurements);


            AiTelemetryConverter.CopyCommonFields(inputTelemetry, result);
            AiTelemetryConverter.CopySamplingFields(inputTelemetry, result);

            return(result);
        }