/** * Gets singleton {@link ServerSpanThreadBinder}. * * @return Singleton {@link ServerSpanThreadBinder}. */ @Bean @Scope(value = "singleton") public ServerSpanThreadBinder threadBinder() { return Brave.getServerSpanThreadBinder(); }
this.eventBuilder.withRequestExecutionStartTime(System.currentTimeMillis()); if (this.taskRequestWrapper.getRequestContext().isPresent() && this.taskRequestWrapper.getRequestContext().get().getCurrentServerSpan() != null) { Brave.getServerSpanThreadBinder().setCurrentSpan(this.taskRequestWrapper.getRequestContext().get().getCurrentServerSpan());
/** Creates a TaskRequestWrapper from passed in params and sets the current server span on it*/ private <S> TaskRequestWrapper createRequestFromParams(String commandName, S data, Map<String, Object> params) { TaskRequestWrapper taskRequestWrapper = new TaskRequestWrapper(); taskRequestWrapper.setCommandName(commandName); taskRequestWrapper.setData(data); taskRequestWrapper.setParams(params); ServerSpan serverSpan = Brave.getServerSpanThreadBinder().getCurrentServerSpan(); if (serverSpan.getSpan() != null) { // set the request context and the current server span on the received request only if a span exists RequestContext serverRequestContext = new RequestContext(); serverRequestContext.setCurrentServerSpan(serverSpan); taskRequestWrapper.setRequestContext(Optional.of(serverRequestContext)); } return taskRequestWrapper; }