-
Anonymous
Nullpointer in tracer.instance.activescope Datadog
Сообщение
Anonymous »
Обновить библиотеку для datadog.tracer: 3.9.0 < /p>
и метод: < /p>
Код: Выделить всё
public static IScope Generate(MethodBase methodBase, string contextId = null)
{
var paths = Regex
.Replace(methodBase.ReflectedType?.FullName?.Replace("+d__(.*)", "", RegexOptions.None, TimeSpan.FromMinutes(5))
.Split(".")
.Skip(1)
.ToArray();
string[] serviceAndMethod = { paths[^2], paths[^1] };
var traceLevel = paths[2];
Tracer.Instance.StartActive(string.Join(".", serviceAndMethod));
if (contextId != null)
Tracer.Instance.ActiveScope.Span.SetTag("contextId", contextId);
Tracer.Instance.ActiveScope.Span.SetTag("traceLevel", traceLevel);
return Tracer.Instance.ActiveScope;
}
сгенерировать ошибку, потому что: Tracer.Instance.ActiveScope возвращаетscopenull в Tracer.Instance.ActiveScope.Span.SetTag("traceLevel",traceLevel)
Подробнее здесь:
https://stackoverflow.com/questions/793 ... pe-datadog
1737998802
Anonymous
Обновить библиотеку для datadog.tracer: 3.9.0 < /p>
и метод: < /p>
[code]public static IScope Generate(MethodBase methodBase, string contextId = null)
{
var paths = Regex
.Replace(methodBase.ReflectedType?.FullName?.Replace("+d__(.*)", "", RegexOptions.None, TimeSpan.FromMinutes(5))
.Split(".")
.Skip(1)
.ToArray();
string[] serviceAndMethod = { paths[^2], paths[^1] };
var traceLevel = paths[2];
Tracer.Instance.StartActive(string.Join(".", serviceAndMethod));
if (contextId != null)
Tracer.Instance.ActiveScope.Span.SetTag("contextId", contextId);
Tracer.Instance.ActiveScope.Span.SetTag("traceLevel", traceLevel);
return Tracer.Instance.ActiveScope;
}
[/code]
сгенерировать ошибку, потому что: Tracer.Instance.ActiveScope возвращаетscopenull в Tracer.Instance.ActiveScope.Span.SetTag("traceLevel",traceLevel)
Подробнее здесь: [url]https://stackoverflow.com/questions/79391650/nullpointer-in-tracer-instance-activescope-datadog[/url]