Anonymous
Nullpointer in tracer.instance.activescope Datadog
Сообщение
Anonymous » 29 янв 2025, 21:24
После обновления библиотеки datadog.tracer для версии 3.9.0 , метод:
Код: Выделить всё
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 возвращает null scope in tracer.instance.activescope.span.settag ("tracelevel" , tracelevel) .
Подробнее здесь:
https://stackoverflow.com/questions/793 ... pe-datadog
1738175073
Anonymous
После обновления библиотеки datadog.tracer для версии 3.9.0 , метод: [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 возвращает null scope in tracer.instance.activescope.span.settag ("tracelevel" , tracelevel) . Подробнее здесь: [url]https://stackoverflow.com/questions/79391650/nullpointer-in-tracer-instance-activescope-datadog[/url]