public void BeginRequest([Property] HttpContext httpContext) { // Console.WriteLine($"{Activity.Current.Id} {Activity.Current.ParentId} {Activity.Current.RootId}"); var carrier = _contextCarrierFactory.Create(); foreach (var item in carrier.Items) { item.HeadValue = httpContext.Request.Headers[item.HeadKey]; } var httpRequestSpan = ConcurrentContextManager.CreateEntrySpan($"{_config.ApplicationCode} {httpContext.Request.Path}", carrier, Activity.Current.Id, Activity.Current.ParentId); httpRequestSpan.AsHttp(); httpRequestSpan.SetComponent(ComponentsDefine.AspNetCore); Tags.Url.Set(httpRequestSpan, httpContext.Request.Path); Tags.HTTP.Method.Set(httpRequestSpan, httpContext.Request.Method); httpRequestSpan.Log(DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(), new Dictionary <string, object> { { "event", "AspNetCore Hosting BeginRequest" }, { "currentActivityId", Activity.Current.Id }, { "currentThreadId", Thread.CurrentThread.ManagedThreadId }, { "Priority", Thread.CurrentThread.Priority }, { "GlobalTraceId", ConcurrentContextManager.GlobalTraceId }, { "message", $"Request starting {httpContext.Request.Protocol} {httpContext.Request.Method} {httpContext.Request.GetDisplayUrl()}" } }); httpContext.Items[HttpContextDiagnosticStrings.SpanKey] = httpRequestSpan; }