.Net Core how to get traceId Skywalking

81 Views Asked by At

I'm using SkyAPM.Agent.AspNetCore 1.1.0, and I need to get the trace id in my code and do something.

However, I didn't find enough information anywhere. Any suggestion?

1

There are 1 best solutions below

0
On BEST ANSWER

Seems I found the solution from the source code.
First inject the IEntrySegmentContextAccessor in the constuctor, then get the traceId by _entrySegmentContextAccessor.Context.TraceId