All following APIs provide readonly features for the tracing context from tracing system. The values are only available when the current thread is traced.
TraceContext.traceId() API to obtain traceId.import org.apache.skywalking.apm.toolkit.trace.TraceContext; ... modelAndView.addObject("traceId", TraceContext.traceId());
TraceContext.segmentId() API to obtain segmentId.import org.apache.skywalking.apm.toolkit.trace.TraceContext; ... modelAndView.addObject("segmentId", TraceContext.segmentId());
TraceContext.spanId() API to obtain spanId.import org.apache.skywalking.apm.toolkit.trace.TraceContext; ... modelAndView.addObject("spanId", TraceContext.spanId());
Sample codes only