/** * Handles the {@link ClientRequestAdapter}. This method should be called when new client * request is created. * * @param <C> * type of carrier adapter is providing * @param requestAdapter * {@link ClientRequestAdapter} providing necessary information. * @return Created span */ public <C> SpanImpl handleRequest(ClientRequestAdapter<C> requestAdapter) { SpanBuilderImpl builder = handleRequestInternal(requestAdapter); // nothing to do if builder was not created if (null == builder) { return null; } // set no reporting as we will do it ourselves in case on sync requests builder.doNotReport(); // start SpanImpl span = builder.start(); // inject here as the context is created when span is started tracer.inject(span.context(), requestAdapter.getFormat(), requestAdapter.getCarrier()); return span; }
/** * Handles the {@link ClientRequestAdapter}. This method should be called when new client * request is created. * * @param <C> * type of carrier adapter is providing * @param requestAdapter * {@link ClientRequestAdapter} providing necessary information. * @return Created span */ public <C> SpanImpl handleAsyncRequest(AsyncClientRequestAdapter<C> requestAdapter) { SpanBuilderImpl builder = handleRequestInternal(requestAdapter); // nothing to do if builder was not created if (null == builder) { return null; } // just build the span and store it for later start SpanImpl span = builder.build(); SpanStore spanStore = new SpanStore(); spanStore.storeSpan(span); requestAdapter.getSpanStoreAdapter().setSpanStore(spanStore); // inject here as the context is created when span is started tracer.inject(span.context(), requestAdapter.getFormat(), requestAdapter.getCarrier()); return span; }