use of fish.payara.notification.requesttracing.RequestTraceSpan in project Payara by payara.
the class FallbackPolicy method fallback.
/**
* Performs the fallback operation defined by the @Fallback annotation.
* @param invocationContext The failing invocation context
* @return The result of the executed fallback method
* @throws Exception If the fallback method itself fails.
*/
public Object fallback(InvocationContext invocationContext) throws Exception {
Object fallbackInvocationContext = null;
FaultToleranceService faultToleranceService = Globals.getDefaultBaseServiceLocator().getService(FaultToleranceService.class);
InvocationManager invocationManager = Globals.getDefaultBaseServiceLocator().getService(InvocationManager.class);
faultToleranceService.startFaultToleranceSpan(new RequestTraceSpan("executeFallbackMethod"), invocationManager, invocationContext);
try {
if (fallbackMethod != null && !fallbackMethod.isEmpty()) {
logger.log(Level.FINE, "Using fallback method: {0}", fallbackMethod);
fallbackInvocationContext = invocationContext.getMethod().getDeclaringClass().getDeclaredMethod(fallbackMethod, invocationContext.getMethod().getParameterTypes()).invoke(invocationContext.getTarget(), invocationContext.getParameters());
} else {
logger.log(Level.FINE, "Using fallback class: {0}", fallbackClass.getName());
ExecutionContext executionContext = new FaultToleranceExecutionContext(invocationContext.getMethod(), invocationContext.getParameters());
fallbackInvocationContext = fallbackClass.getDeclaredMethod(FALLBACK_HANDLER_METHOD_NAME, ExecutionContext.class).invoke(CDI.current().select(fallbackClass).get(), executionContext);
}
} finally {
faultToleranceService.endFaultToleranceSpan();
}
return fallbackInvocationContext;
}
use of fish.payara.notification.requesttracing.RequestTraceSpan in project Payara by payara.
the class RequestTracingCdiInterceptor method traceCdiCall.
@AroundInvoke
public Object traceCdiCall(InvocationContext ctx) throws Exception {
RequestTracingService requestTracing = Globals.getDefaultHabitat().getService(RequestTracingService.class);
Object proceed = null;
if (requestTracing != null && requestTracing.isRequestTracingEnabled()) {
RequestTraceSpan span = new RequestTraceSpan("executeCdiMethod");
span.addSpanTag("TargetClass", ctx.getTarget().getClass().getName());
span.addSpanTag("MethodName", ctx.getMethod().getName());
proceed = ctx.proceed();
requestTracing.traceSpan(span);
} else {
proceed = ctx.proceed();
}
return proceed;
}
use of fish.payara.notification.requesttracing.RequestTraceSpan in project Payara by payara.
the class EjbWebServiceServlet method constructWsRequestSpan.
private RequestTraceSpan constructWsRequestSpan(HttpServletRequest httpServletRequest, EjbRuntimeEndpointInfo ejbEndpoint) {
RequestTraceSpan span = new RequestTraceSpan("processSoapWebserviceRequest");
span.addSpanTag("URI", ejbEndpoint.getEndpoint().getEndpointAddressUri());
span.addSpanTag("URL", httpServletRequest.getRequestURL().toString());
Enumeration<String> headerNames = httpServletRequest.getHeaderNames();
while (headerNames.hasMoreElements()) {
String headerName = headerNames.nextElement();
List<String> headers = Collections.list(httpServletRequest.getHeaders(headerName));
span.addSpanTag(headerName, headers.toString());
}
span.addSpanTag("Method", httpServletRequest.getMethod());
return span;
}
use of fish.payara.notification.requesttracing.RequestTraceSpan in project Payara by payara.
the class JAXWSServlet method doPost.
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException {
startedEvent(endpoint.getEndpointAddressPath());
if (("Tester".equalsIgnoreCase(request.getQueryString())) && (!(HTTPBinding.HTTP_BINDING.equals(endpoint.getProtocolBinding())))) {
Endpoint endpt = wsEngine_.getEndpoint(request.getServletPath());
if (endpt != null && Boolean.parseBoolean(endpt.getDescriptor().getDebugging())) {
WebServiceTesterServlet.invoke(request, response, endpt.getDescriptor());
endedEvent(endpoint.getEndpointAddressPath());
return;
}
}
// lookup registered URLs and get the appropriate adapter;
// pass control to the adapter
RequestTraceSpan span = null;
try {
ServletAdapter targetEndpoint = (ServletAdapter) getEndpointFor(request);
if (targetEndpoint != null) {
if (requestTracing.isRequestTracingEnabled()) {
span = constructWsRequestSpan(request, targetEndpoint.getAddress());
}
targetEndpoint.handle(getServletContext(), request, response);
} else {
throw new ServletException("Service not found");
}
} catch (Throwable t) {
ServletException se = new ServletException();
se.initCause(t);
throw se;
} finally {
if (requestTracing.isRequestTracingEnabled() && span != null) {
requestTracing.traceSpan(span);
}
}
endedEvent(endpoint.getEndpointAddressPath());
}
use of fish.payara.notification.requesttracing.RequestTraceSpan in project Payara by payara.
the class RequestTracingService method startTrace.
/**
* Starts a new request trace
* @return a unique identifier for the request trace
*/
public UUID startTrace(String traceName) {
if (!isRequestTracingEnabled()) {
return null;
}
// Check if the trace came from an admin listener. If it did, and 'applications only' is enabled, ignore the trace.
if (executionOptions.getApplicationsOnlyEnabled() == true && Thread.currentThread().getName().matches("admin-thread-pool::admin-listener\\([0-9]+\\)")) {
return null;
}
// Determine whether to sample the request, if sampleRateFirstEnabled is true
if (executionOptions.getSampleRateFirstEnabled()) {
if (!sampleFilter.sample()) {
return null;
}
}
RequestTraceSpan span = new RequestTraceSpan(EventType.TRACE_START, traceName);
span.addSpanTag("Server", server.getName());
span.addSpanTag("Domain", domain.getName());
requestEventStore.storeEvent(span);
return span.getId();
}
Aggregations