code: private void startSpan(ActivityRuntimeContext context) {
          Tracing tracing = TraceHelper.getTracing("mdw-activity");
          Tracer tracer = tracing.tracer();
          Span span = tracer.currentSpan();
          if (span == null) {
              // async brave server if b3 requestHeaders populated (subspan)
              Object requestHeaders = context.getValue("requestHeaders");
              if (requestHeaders instanceof Map) {
                  Map<?, ?> headers = (Map<?, ?>) requestHeaders;
                  if (headers.containsKey("x-b3-traceid")) {
                      TraceContext.Extractor<Map<?, ?>> extractor =
                              tracing.propagation().extractor((map, key) -> {
                                  Object val = map.get(key.toLowerCase());
                                  return val == null ? null : val.toString();
                              });
                      TraceContextOrSamplingFlags extracted = extractor.extract(headers);
                      span = extracted.context() != null
                              ? tracer.joinSpan(extracted.context())
                              : tracer.nextSpan(extracted);
                      span.name("m" + context.getMasterRequestId()).kind(Span.Kind.SERVER);
                      span = tracer.newChild(span.context()).name("p" + context.getProcessInstanceId());
                  }
              }
          }
          if (span == null) {
              // create a new root span for async start
              span = tracer.nextSpan().name("a" + context.getActivityInstanceId());
          }
          span.start().flush(); // async
          Tracer.SpanInScope spanInScope = tracer.withSpanInScope(span);
          context.getRuntimeAttributes().put(Tracer.SpanInScope.class, spanInScope);
      }
docs: Resumes or forks