use of com.enonic.xp.trace.Trace in project xp by enonic.
the class WebSocketEntryImpl method onEvent.
private void onEvent(final WebSocketEvent event) {
final Trace trace = Tracer.newTrace("websocket");
if (trace == null || traceApp == null) {
this.endpoint.onEvent(event);
} else {
trace.put("message", event.getMessage());
trace.put("type", event.getType() == MESSAGE ? "message_received" : event.getType().toString().toLowerCase());
trace.put("sessionid", event.getSession().getId());
trace.put("parentId", traceParentId);
trace.put("app", traceApp);
Tracer.trace(trace, () -> this.endpoint.onEvent(event));
}
}
use of com.enonic.xp.trace.Trace in project xp by enonic.
the class PageHandler method doHandle.
@Override
protected PortalResponse doHandle(final WebRequest webRequest, final WebResponse webResponse, final WebHandlerChain webHandlerChain) throws Exception {
WebHandlerHelper.checkAdminAccess(webRequest);
final PageHandlerWorker worker = new PageHandlerWorker((PortalRequest) webRequest);
worker.contentResolver = new ContentResolver(contentService);
worker.rendererDelegate = rendererDelegate;
worker.pageResolver = new PageResolver(pageTemplateService);
worker.pageDescriptorService = pageDescriptorService;
worker.portalUrlService = portalUrlService;
final Trace trace = Tracer.newTrace("renderComponent");
if (trace == null) {
return worker.execute();
}
return Tracer.traceEx(trace, worker::execute);
}
use of com.enonic.xp.trace.Trace in project xp by enonic.
the class PageHandlerWorker method execute.
@Override
public PortalResponse execute() throws Exception {
final ContentResolverResult resolvedContent = contentResolver.resolve(this.request);
final Content content = resolvedContent.getContentOrElseThrow();
if (content.getType().isShortcut()) {
return renderShortcut(content);
}
final Site site = resolvedContent.getNearestSiteOrElseThrow();
final PageResolverResult resolvedPage = pageResolver.resolve(request.getMode(), content, site);
final Content effectiveContent = Content.create(content).page(resolvedPage.getEffectivePage()).build();
final DescriptorKey pageDescriptorKey = resolvedPage.getController();
this.request.setSite(site);
this.request.setContent(effectiveContent);
this.request.setApplicationKey(pageDescriptorKey != null ? pageDescriptorKey.getApplicationKey() : null);
this.request.setPageDescriptor(pageDescriptorKey != null ? this.pageDescriptorService.getByKey(pageDescriptorKey) : null);
final Trace trace = Tracer.current();
if (trace != null) {
trace.put("contentPath", effectiveContent.getPath().toString());
trace.put("type", "page");
}
return rendererDelegate.render(effectiveContent, this.request);
}
use of com.enonic.xp.trace.Trace in project xp by enonic.
the class ImageHandlerWorker method addTrace.
@Override
protected void addTrace(final Media content) {
final Trace trace = Tracer.current();
if (trace != null) {
trace.put("contentPath", content.getPath());
trace.put("type", "image");
}
}
use of com.enonic.xp.trace.Trace in project xp by enonic.
the class MappingFilterHandlerWorker method execute.
@Override
public PortalResponse execute() throws Exception {
final Trace trace = Tracer.current();
if (trace != null) {
trace.put("contentPath", this.request.getContentPath().toString());
trace.put("type", "filter");
}
final FilterScript filterScript = getScript();
return filterScript.execute(this.request, this.response, this.webHandlerChain);
}
Aggregations