Ejemplo n.º 1
0
        public ErrorEventEntity FilterContents(ErrorEventEntity errorEventEntity)
        {
            foreach (var exception in errorEventEntity.Exceptions)
            {
                FilterStackFrames(exception);
                ReDepthIndexStackFrames(exception);
            }

            return errorEventEntity;
        }
Ejemplo n.º 2
0
        public ErrorEventEntity Parse(InputLogEvent inputLogEvent)
        {
            var error = new ErrorEventEntity();
            error.Application = inputLogEvent.ApplicationId;
            error.Server = inputLogEvent.Server;
            error.MessageSource = inputLogEvent.Message;

            ExtractExceptionData(error);

            return error;
        }
Ejemplo n.º 3
0
        public ErrorEventEntity Parse(InputLogEvent inputLogEvent)
        {
            var error = new ErrorEventEntity();
            error.Application = inputLogEvent.ApplicationId;
            error.Server = inputLogEvent.Server;
            error.MessageSource = inputLogEvent.Message;

            var tokens = _errorTokenizer.Tokenize(inputLogEvent.Message).ToList();
            var parseResult = new TokenBasedErrorParser(_grammarParserConfiguration).Parse(tokens);

            error.ApplicationDateTime = parseResult.ErrorDateTime;
            error.Exceptions = parseResult.Exceptions;

            return error;
        }
Ejemplo n.º 4
0
        public static Fingerprint ComputeFingerprint(ErrorEventEntity errorEvent)
        {
            var sb = new StringBuilder();

            foreach (var exception in errorEvent.Exceptions.OrderBy(ex => ex.Depth))
            {
                sb.Append(exception.Depth);
                sb.Append(exception.ExceptionType);
                foreach (var stackFrame in exception.StackFrames.OrderBy(sf => sf.Depth))
                {
                    sb.Append(stackFrame.Depth);
                    sb.Append(stackFrame.Path);
                }
            }

            return GetMd5Fingerprint(sb.ToString());
        }
Ejemplo n.º 5
0
        public static ErrorEventEntity GenerateErrorWithOneException()
        {
            var error = new ErrorEventEntity();
            error.Exceptions = new List<ExceptionEntity>();
            error.Exceptions.Add(new ExceptionEntity()
            {
                Depth = 1,
                ExceptionType = "System.IndexOutOfRangeException",
                Message = "Index out of range",
                StackFrames = new List<StackFrameEntity>()
                {
                    new StackFrameEntity() { Depth = 1, IsApplicationCode = false, Path = "System.ServiceModel.Etc"},
                    new StackFrameEntity() { Depth = 2, IsApplicationCode = true, Path = "Logari.ErrorGenerator.Program.RunJob()"},
                    new StackFrameEntity() { Depth = 3, IsApplicationCode = false, Path = "System.Collections.Generic.List`1.Add(T item)"},
                }
            });

            return error;
        }
Ejemplo n.º 6
0
        private string GetMessageDetails(ErrorEventEntity errorEvent)
        {
            var sb = new StringBuilder();
            sb.Append("[");
            int counter = 0;
            foreach (var exception in errorEvent.Exceptions)
            {
                if (counter > 0)
                    sb.Append(",");
                sb.Append("{");
                sb.Append("\"Depth\": " + exception.Depth + ",");
                sb.Append("\"Type\": \"" + exception.ExceptionType + "\",");
                sb.Append("\"Message\": \"" + exception.Message + "\"");
                sb.Append("}");

                counter++;
            }

            sb.Append("]");

            return sb.ToString();
        }
Ejemplo n.º 7
0
 private void ExtractExceptionData(ErrorEventEntity errorEntity)
 {
     errorEntity.ApplicationDateTime = GetApplicationDateTime(errorEntity.MessageSource);
     
     var exceptionTextBlocks = SplitIntoExceptionTextBlocks(errorEntity.MessageSource);
     errorEntity.Exceptions = new List<ExceptionEntity>();
     foreach (var exceptionTextBlock in exceptionTextBlocks)
     {
         errorEntity.Exceptions.Add(GetException(exceptionTextBlock));
     }
 }
Ejemplo n.º 8
0
        private ErrorEventPacket RecombineEventPacket(ErrorDefinitionEntity errorDefinition, ErrorInstanceEntity errorInstance)
        {
            var inputLogEvent = new InputLogEvent();
            inputLogEvent.Message = errorDefinition.MessageSource;

            var errorEvent = new ErrorEventEntity();
            errorEvent.Application = errorDefinition.Application;
            errorEvent.ApplicationDateTime = errorInstance.ApplicationDateTime;
            errorEvent.Exceptions = RecombineExceptions(errorDefinition.Exceptions, errorInstance.Exceptions);
            errorEvent.Fingerprint = errorDefinition.Fingerprint;
            errorEvent.MessageSource = errorDefinition.MessageSource;
            errorEvent.Server = GetFromServerCache(errorInstance.ServerCacheId);

            var eventPacket = new ErrorEventPacket(inputLogEvent);
            eventPacket.ErrorEventEntity = errorEvent;

            return eventPacket;
        }