apm-agent-plugins/apm-jms-plugin/apm-jms-jakarta/src/main/java/co/elastic/apm/agent/jms/jakarta/JmsMessageProducerInstrumentation.java [77:108]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            @Advice.OnMethodEnter(suppress = Throwable.class, inline = false)
            @Nullable
            public static Object beforeSend(@Advice.Argument(0) final Message message,
                                            @Advice.This final MessageProducer producer) {

                try {
                    Destination destination = producer.getDestination();
                    return helper.startJmsSendSpan(destination, message);
                } catch (JMSException e) {
                    logger.warn("Failed to retrieve message's destination", e);
                }
                return null;
            }

            @Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class, inline = false)
            public static void afterSend(@Advice.Enter @Nullable final Object spanObj,
                                         @Advice.Thrown final Throwable throwable) {

                if (spanObj instanceof Span<?>) {
                    Span<?> span = (Span<?>) spanObj;
                    span.captureException(throwable);
                    span.deactivate().end();
                }
            }
        }
    }

    public static class JmsMessageProducerWithDestinationInstrumentation extends JmsMessageProducerInstrumentation {

        @Override
        public ElementMatcher<? super MethodDescription> getMethodMatcher() {
            return named("send")
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



apm-agent-plugins/apm-jms-plugin/apm-jms-javax/src/main/java/co/elastic/apm/agent/jms/javax/JmsMessageProducerInstrumentation.java [77:108]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            @Advice.OnMethodEnter(suppress = Throwable.class, inline = false)
            @Nullable
            public static Object beforeSend(@Advice.Argument(0) final Message message,
                                            @Advice.This final MessageProducer producer) {

                try {
                    Destination destination = producer.getDestination();
                    return helper.startJmsSendSpan(destination, message);
                } catch (JMSException e) {
                    logger.warn("Failed to retrieve message's destination", e);
                }
                return null;
            }

            @Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class, inline = false)
            public static void afterSend(@Advice.Enter @Nullable final Object spanObj,
                                         @Advice.Thrown final Throwable throwable) {

                if (spanObj instanceof Span<?>) {
                    Span<?> span = (Span<?>) spanObj;
                    span.captureException(throwable);
                    span.deactivate().end();
                }
            }
        }
    }

    public static class JmsMessageProducerWithDestinationInstrumentation extends JmsMessageProducerInstrumentation {

        @Override
        public ElementMatcher<? super MethodDescription> getMethodMatcher() {
            return named("send")
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



