@Override public void filter(ClientRequestContext request, ClientResponseContext response) { Span span = tracer.currentSpan(); if (span == null) return; ((Tracer.SpanInScope) request.getProperty(Tracer.SpanInScope.class.getName())).close(); handler.handleReceive(response, null, span); }
@Override public void send(Message message) throws JMSException { Span span = createAndStartProducerSpan(null, message); SpanInScope ws = tracer.withSpanInScope(span); // animal-sniffer mistakes this for AutoCloseable try { delegate.send(message); } catch (RuntimeException | JMSException | Error e) { span.error(e); throw e; } finally { ws.close(); span.finish(); } }
@Override public void send(Message message, int deliveryMode, int priority, long timeToLive) throws JMSException { Span span = createAndStartProducerSpan(null, message); SpanInScope ws = tracer.withSpanInScope(span); // animal-sniffer mistakes this for AutoCloseable try { delegate.send(message, deliveryMode, priority, timeToLive); } catch (RuntimeException | JMSException | Error e) { span.error(e); throw e; } finally { ws.close(); span.finish(); } }
@JMS2_0 public void send(Message message, int deliveryMode, int priority, long timeToLive, CompletionListener completionListener) throws JMSException { Span span = createAndStartProducerSpan(null, message); completionListener = TracingCompletionListener.create(completionListener, span, current); SpanInScope ws = tracer.withSpanInScope(span); // animal-sniffer mistakes this for AutoCloseable try { delegate.send(message, deliveryMode, priority, timeToLive, completionListener); } catch (RuntimeException | JMSException | Error e) { span.error(e); span.finish(); throw e; } finally { ws.close(); } }
@Override public void publish(Message message) throws JMSException { checkTopicPublisher(); TopicPublisher tp = (TopicPublisher) delegate; Span span = createAndStartProducerSpan(null, message); SpanInScope ws = tracer.withSpanInScope(span); // animal-sniffer mistakes this for AutoCloseable try { tp.publish(message); } catch (RuntimeException | JMSException | Error e) { span.error(e); throw e; } finally { ws.close(); span.finish(); } }
@Override public void send(Destination destination, Message message, int deliveryMode, int priority, long timeToLive) throws JMSException { Span span = createAndStartProducerSpan(destination, message); SpanInScope ws = tracer.withSpanInScope(span); // animal-sniffer mistakes this for AutoCloseable try { delegate.send(destination, message, deliveryMode, priority, timeToLive); } catch (RuntimeException | JMSException | Error e) { span.error(e); throw e; } finally { ws.close(); span.finish(); } }
@JMS2_0 public void send(Message message, CompletionListener completionListener) throws JMSException { Span span = createAndStartProducerSpan(null, message); SpanInScope ws = tracer.withSpanInScope(span); // animal-sniffer mistakes this for AutoCloseable try { delegate.send(message, TracingCompletionListener.create(completionListener, span, current)); } catch (RuntimeException | JMSException | Error e) { span.error(e); span.finish(); throw e; } finally { ws.close(); } }
@JMS2_0 public void send(Destination destination, Message message, int deliveryMode, int priority, long timeToLive, CompletionListener completionListener) throws JMSException { Span span = createAndStartProducerSpan(destination, message); completionListener = TracingCompletionListener.create(completionListener, span, current); SpanInScope ws = tracer.withSpanInScope(span); // animal-sniffer mistakes this for AutoCloseable try { delegate.send(destination, message, deliveryMode, priority, timeToLive, completionListener); } catch (RuntimeException | JMSException | Error e) { span.error(e); span.finish(); throw e; } finally { ws.close(); } }
@JMS2_0 public void send(Destination destination, Message message, CompletionListener completionListener) throws JMSException { Span span = createAndStartProducerSpan(destination, message); completionListener = TracingCompletionListener.create(completionListener, span, current); SpanInScope ws = tracer.withSpanInScope(span); // animal-sniffer mistakes this for AutoCloseable try { delegate.send(destination, message, completionListener); } catch (RuntimeException | JMSException | Error e) { span.error(e); span.finish(); throw e; } finally { ws.close(); } }
@Override public void onHalfClose() { SpanInScope scope = tracer.withSpanInScope(span); try { // retrolambda can't resolve this try/finally delegate().onHalfClose(); } catch (RuntimeException | Error e) { // If there was an exception executing onHalfClose, we don't expect other lifecycle // commands to succeed. Accordingly, we close the span span.error(e); span.finish(); throw e; } finally { scope.close(); } }
void send(SendDestination sendDestination, Destination destination, Message message) throws JMSException { Span span = createAndStartProducerSpan(destination, message); SpanInScope ws = tracer.withSpanInScope(span); // animal-sniffer mistakes this for AutoCloseable try { sendDestination.apply(delegate, destination, message); } catch (RuntimeException | JMSException | Error e) { span.error(e); throw e; } finally { ws.close(); span.finish(); } }
void handleReceive(Span clientSpan, Tracer.SpanInScope ws, ClientResponse clientResponse, Throwable throwable) { this.handler.handleReceive(clientResponse, throwable, clientSpan); ws.close(); }
@Override public void onMessage(RespT message) { SpanInScope scope = tracer.withSpanInScope(span); try { // retrolambda can't resolve this try/finally parser.onMessageReceived(message, span.customizer()); delegate().onMessage(message); } finally { scope.close(); } }
@Override public void onClose(Status status, Metadata trailers) { SpanInScope scope = tracer.withSpanInScope(span); try { super.onClose(status, trailers); parser.onClose(status, trailers, span.customizer()); } finally { scope.close(); span.finish(); } } }
public ExceptionHandler exception(ExceptionHandler delegate) { return (exception, request, response) -> { Span span = tracer.currentSpan(); if (span != null) { ((Tracer.SpanInScope) request.attribute(Tracer.SpanInScope.class.getName())).close(); handler.handleSend(ADAPTER.adaptResponse(request.raw(), response.raw()), exception, span); } delegate.handle(exception, request, response); }; } }
@Override public void onReady() { SpanInScope scope = tracer.withSpanInScope(span); try { // retrolambda can't resolve this try/finally delegate().onReady(); } finally { scope.close(); } } }
@Override public void onComplete() { SpanInScope scope = tracer.withSpanInScope(span); try { // retrolambda can't resolve this try/finally delegate().onComplete(); } finally { scope.close(); } }
@Override public void onCancel() { SpanInScope scope = tracer.withSpanInScope(span); try { // retrolambda can't resolve this try/finally delegate().onCancel(); } finally { scope.close(); } }
@Override public void onMessage(ReqT message) { SpanInScope scope = tracer.withSpanInScope(span); try { // retrolambda can't resolve this try/finally parser.onMessageReceived(message, span.customizer()); delegate().onMessage(message); } finally { scope.close(); } }
public Filter afterAfter() { return (request, response) -> { Span span = tracer.currentSpan(); if (span == null) return; ((Tracer.SpanInScope) request.attribute(Tracer.SpanInScope.class.getName())).close(); handler.handleSend(ADAPTER.adaptResponse(request.raw(), response.raw()), null, span); }; }