-
Notifications
You must be signed in to change notification settings - Fork 333
Open
Description
Please answer these questions before submitting your issue.
- Why do you submit this issue?
- Question or discussion
- Bug
- Requirement
- Feature or performance improvement
Question
- What do you want to know?
Currently, when callingSegmentSpan.ErrorOccurred(Exception, TracingConfig)
, you need to pass in theTracingConfig
parameter. Is it better to move the logic ofErrorOccurred
intoTracingContext
?TracingContext
can hold aTracingConfig
object, which is much more convenient than getting aTracingConfig
every timeErrorOccurred
is called.
现在我们调用SegmentSpan.ErrorOccurred(Exception, TracingConfig)
方法的时候需要传入TracingConfig
参数,将ErrorOccurred
的逻辑移动到TracingContext
中是否更好?TracingContext
可以持有一个TracingConfig
对象,相比每次调用ErrorOccurred
都去获取一个TracingConfig
会方便很多。
public interface ITracingContext
{
// ...
void ErrorOccurred(SegmentContext context, Exception exception);
}
public class TracingContext : ITracingContext
{
// ....
public void ErrorOccurred(SegmentContext context, Exception exception)
{
if (context == null || context.Span == null)
return;
context.Span.IsError = true;
if (exception == null)
return;
var stackTrace = exception.HasInnerExceptions() ? exception.ToDemystifiedString(_tracingConfig.ExceptionMaxDepth) : exception.StackTrace;
context.Span.AddLog(LogEvent.Event("error"),
LogEvent.ErrorKind(exception.GetType().FullName),
LogEvent.Message(exception.Message),
LogEvent.ErrorStack(stackTrace));
}
}
Bug
-
Which version of SkyWalking, OS and .NET Runtime?
-
Which company or project?
-
What happen?
If possible, provide a way for reproducing the error. e.g. demo application, component version.
Requirement or improvement
- Please describe about your requirements or improvement suggestions.
Metadata
Metadata
Assignees
Labels
No labels