use of fish.payara.notification.requesttracing.RequestTraceSpan in project Payara by payara.
the class RealmAdapter method doTraced.
private boolean doTraced(ServerAuthConfig serverAuthConfig, Context context, RequestFacade requestFacade, IOSupplier<Boolean> supplier) throws IOException {
RequestTraceSpan span = null;
boolean result;
try {
span = new RequestTraceSpan("authenticateJaspic");
span.addSpanTag("AppContext", serverAuthConfig.getAppContext());
span.addSpanTag("Context", context.getPath());
result = supplier.get();
span.addSpanTag("AuthResult", Boolean.toString(result));
Principal principal = requestFacade.getPrincipal();
String principalName = "null";
if (principal != null) {
principalName = principal.getName();
}
span.addSpanTag("Principal", principalName);
} finally {
if (span != null) {
requestTracing.traceSpan(span);
}
}
return result;
}
use of fish.payara.notification.requesttracing.RequestTraceSpan in project Payara by payara.
the class MessageBeanListenerImpl method deliverMessage.
@Override
public Object deliverMessage(Object[] params) throws Throwable {
if (stuckThreadsStore != null) {
stuckThreadsStore.registerThread(Thread.currentThread().getId());
}
RequestTraceSpan span = null;
if (requestTracing != null && requestTracing.isRequestTracingEnabled()) {
span = new RequestTraceSpan(EventType.TRACE_START, "deliverMdb");
span.addSpanTag("MDB Class", container_.getEjbDescriptor().getEjbClassName());
span.addSpanTag("Message Count", Long.toString(container_.getMessageCount()));
span.addSpanTag("JNDI", container_.getEjbDescriptor().getJndiName());
try {
javax.jms.Message msg = (javax.jms.Message) params[0];
span.addSpanTag("JMS Type", msg.getJMSType());
span.addSpanTag("JMS CorrelationID", msg.getJMSCorrelationID());
span.addSpanTag("JMS MessageID", msg.getJMSMessageID());
span.addSpanTag("JMS Destination", getDestinationName(msg.getJMSDestination()));
span.addSpanTag("JMS ReplyTo", getDestinationName(msg.getJMSReplyTo()));
// check RT conversation ID
UUID conversationID = (UUID) msg.getObjectProperty("#BAF-CID");
if (conversationID != null) {
// reset the conversation ID to match the received ID to
// propagate the conversation across the message send
requestTracing.setTraceId(conversationID);
}
} catch (ClassCastException cce) {
}
requestTracing.startTrace(span);
}
try {
return container_.deliverMessage(params);
} finally {
if (requestTracing != null && requestTracing.isRequestTracingEnabled()) {
requestTracing.endTrace();
}
if (stuckThreadsStore != null) {
stuckThreadsStore.deregisterThread(Thread.currentThread().getId());
}
}
}
use of fish.payara.notification.requesttracing.RequestTraceSpan in project Payara by payara.
the class EjbWebServiceServlet method service.
@Override
protected void service(HttpServletRequest hreq, HttpServletResponse hresp) throws ServletException, IOException {
String requestUriRaw = hreq.getRequestURI();
String requestUri = (requestUriRaw.charAt(0) == '/') ? requestUriRaw.substring(1) : requestUriRaw;
String query = hreq.getQueryString();
WebServiceEjbEndpointRegistry wsejbEndpointRegistry = (WebServiceEjbEndpointRegistry) Globals.getDefaultHabitat().getService(WSEjbEndpointRegistry.class);
EjbRuntimeEndpointInfo ejbEndpoint = wsejbEndpointRegistry.getEjbWebServiceEndpoint(requestUri, hreq.getMethod(), query);
if (requestUri.contains(WebServiceEndpoint.PUBLISHING_SUBCONTEXT) && ejbEndpoint == null) {
requestUri = requestUri.substring(0, requestUri.indexOf(WebServiceEndpoint.PUBLISHING_SUBCONTEXT) - 1);
ejbEndpoint = wsejbEndpointRegistry.getEjbWebServiceEndpoint(requestUri, hreq.getMethod(), query);
}
if (ejbEndpoint != null) {
/*
* We can actually assert that ejbEndpoint is != null,
* because this EjbWebServiceServlet would not have been
* invoked otherwise
*/
String scheme = hreq.getScheme();
WebServiceEndpoint wse = ejbEndpoint.getEndpoint();
if ("http".equals(scheme) && wse.isSecure()) {
// redirect to correct protocol scheme if needed
logger.log(Level.WARNING, LogUtils.INVALID_REQUEST_SCHEME, new Object[] { wse.getEndpointName(), "https", scheme });
URL url = wse.composeEndpointAddress(new WsUtil().getWebServerInfoForDAS().getWebServerRootURL(true));
StringBuilder sb = new StringBuilder(url.toExternalForm());
if (query != null && query.trim().length() > 0) {
sb.append("?");
sb.append(query);
}
hresp.sendRedirect(hresp.encodeRedirectURL(sb.toString()));
} else {
boolean dispatch = true;
// check if it is a tester servlet invocation
if ("Tester".equalsIgnoreCase(query) && (!(HTTPBinding.HTTP_BINDING.equals(wse.getProtocolBinding())))) {
Endpoint endpoint = WebServiceEngineImpl.getInstance().getEndpoint(hreq.getRequestURI());
if ((endpoint.getDescriptor().isSecure()) || (endpoint.getDescriptor().getMessageSecurityBinding() != null)) {
String message = endpoint.getDescriptor().getWebService().getName() + "is a secured web service; Tester feature is not supported for secured services";
(new WsUtil()).writeInvalidMethodType(hresp, message);
return;
}
if (Boolean.parseBoolean(endpoint.getDescriptor().getDebugging())) {
dispatch = false;
WebServiceTesterServlet.invoke(hreq, hresp, endpoint.getDescriptor());
}
}
if ("wsdl".equalsIgnoreCase(query) && (!(HTTPBinding.HTTP_BINDING.equals(wse.getProtocolBinding())))) {
if (wse.getWsdlExposed() != null && !Boolean.parseBoolean(wse.getWsdlExposed())) {
hresp.sendError(HttpServletResponse.SC_NOT_FOUND);
}
}
if (dispatch) {
RequestTraceSpan span = null;
try {
if (requestTracing.isRequestTracingEnabled()) {
span = constructWsRequestSpan(hreq, ejbEndpoint);
}
dispatchToEjbEndpoint(hreq, hresp, ejbEndpoint);
} finally {
if (requestTracing.isRequestTracingEnabled() && span != null) {
requestTracing.traceSpan(span);
}
}
}
}
} else {
hresp.sendError(HttpServletResponse.SC_NOT_FOUND);
}
}
use of fish.payara.notification.requesttracing.RequestTraceSpan in project Payara by payara.
the class JAXWSServlet method constructWsRequestSpan.
private RequestTraceSpan constructWsRequestSpan(HttpServletRequest httpServletRequest, URI uri) {
RequestTraceSpan span = new RequestTraceSpan("processSoapWebserviceRequest");
span.addSpanTag("URI", uri.toString());
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 RequestTracingService method startTrace.
public UUID startTrace(UUID propagatedTraceId, UUID propagatedParentId, RequestTraceSpan.SpanContextRelationshipType propagatedRelationshipType, String traceName) {
if (!isRequestTracingEnabled()) {
return null;
}
RequestTraceSpan span = new RequestTraceSpan(EventType.PROPAGATED_TRACE, traceName, propagatedTraceId, propagatedParentId, propagatedRelationshipType);
span.addSpanTag("Server", server.getName());
span.addSpanTag("Domain", domain.getName());
requestEventStore.storeEvent(span);
return span.getId();
}
Aggregations