Exemplo n.º 1
0
        public string ClassifyFailure(ClassifiableMessageDetails failure)
        {
            var exception = failure.Details?.Exception;

            if (exception == null)
            {
                return(null);
            }

            if (string.IsNullOrWhiteSpace(exception.StackTrace))
            {
                return(GetNonStandardClassification(exception.ExceptionType));
            }

            var firstStackTraceFrame = StackTraceParser.Parse(exception.StackTrace, (frame, type, method, parameterList, parameters, file, line) => new StackFrame
            {
                Type   = type,
                Method = method,
                Params = parameterList,
                File   = file,
                Line   = line
            }).FirstOrDefault();

            if (firstStackTraceFrame != null)
            {
                return(exception.ExceptionType + ": " + firstStackTraceFrame.ToMethodIdentifier());
            }

            return(GetNonStandardClassification(exception.ExceptionType));
        }
        IEnumerable <FailedMessage.FailureGroup> GetClassificationGroups(ClassifiableMessageDetails details)
        {
            foreach (var classifier in classifiers)
            {
                var classification = classifier.ClassifyFailure(details);
                if (classification == null)
                {
                    continue;
                }

                var id = DeterministicGuid.MakeId(classifier.Name, classification).ToString();

                yield return(new FailedMessage.FailureGroup
                {
                    Id = id,
                    Title = classification,
                    Type = classifier.Name
                });
            }
        }
Exemplo n.º 3
0
        public IEnumerable <FailedMessage.FailureGroup> Enrich(string messageType, FailureDetails failureDetails, FailedMessage.ProcessingAttempt processingAttempt)
        {
            var details = new ClassifiableMessageDetails(messageType, failureDetails, processingAttempt);

            foreach (var classifier in classifiers)
            {
                var classification = classifier.ClassifyFailure(details);

                if (classification == null)
                {
                    continue;
                }

                yield return(new FailedMessage.FailureGroup
                {
                    Id = DeterministicGuid.MakeId(classifier.Name, classification).ToString(),
                    Title = classification,
                    Type = classifier.Name
                });
            }
        }
        public string ClassifyFailure(ClassifiableMessageDetails failure)
        {
            var exception = failure.Details?.Exception;

            if (exception == null)
            {
                return(null);
            }

            if (string.IsNullOrWhiteSpace(exception.StackTrace))
            {
                return(GetNonStandardClassification(exception.ExceptionType));
            }


            var exceptionStackTrace = exception.StackTrace;

            if (!string.IsNullOrEmpty(exception.Message))
            {
                // The StackTrace message header contains the result of ToString call on the exception object so it includes the message
                // We need to remove the message in order to make sure the stack trace parser does not get into catastrophic backtracking mode.
                exceptionStackTrace = exceptionStackTrace.Replace(exception.Message, string.Empty);
            }

            var firstStackTraceFrame = StackTraceParser.Parse(exceptionStackTrace, (frame, type, method, parameterList, parameters, file, line) => new StackFrame
            {
                Type   = type,
                Method = method,
                Params = parameterList,
                File   = file,
                Line   = line
            }).FirstOrDefault();

            if (firstStackTraceFrame != null)
            {
                return(exception.ExceptionType + ": " + firstStackTraceFrame.ToMethodIdentifier());
            }

            return(GetNonStandardClassification(exception.ExceptionType));
        }
Exemplo n.º 5
0
        public string ClassifyFailure(ClassifiableMessageDetails failure)
        {
            var exception = failure.Details?.Exception;

            if (exception == null)
            {
                return(null);
            }

            if (string.IsNullOrWhiteSpace(exception.StackTrace))
            {
                return(GetNonStandardClassification(exception.ExceptionType));
            }

            var firstStackTraceFrame = StackTraceParser.Parse(exception.StackTrace).FirstOrDefault();

            if (firstStackTraceFrame != null)
            {
                return(exception.ExceptionType + ": " + firstStackTraceFrame.ToMethodIdentifier());
            }

            return(GetNonStandardClassification(exception.ExceptionType));
        }
Exemplo n.º 6
0
 public string ClassifyFailure(ClassifiableMessageDetails failureDetails)
 {
     return(failureDetails.ProcessingAttempt == null
         ? null
         : ExtractEndpointName(failureDetails.ProcessingAttempt.Headers));
 }