Search in sources :

Example 16 with Trace

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));
    }
}
Also used : Trace(com.enonic.xp.trace.Trace)

Example 17 with Trace

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);
}
Also used : Trace(com.enonic.xp.trace.Trace) ContentResolver(com.enonic.xp.portal.impl.ContentResolver)

Example 18 with Trace

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);
}
Also used : ContentResolverResult(com.enonic.xp.portal.impl.ContentResolverResult) Site(com.enonic.xp.site.Site) Trace(com.enonic.xp.trace.Trace) Content(com.enonic.xp.content.Content) DescriptorKey(com.enonic.xp.page.DescriptorKey)

Example 19 with Trace

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");
    }
}
Also used : Trace(com.enonic.xp.trace.Trace)

Example 20 with Trace

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);
}
Also used : Trace(com.enonic.xp.trace.Trace) FilterScript(com.enonic.xp.portal.filter.FilterScript)

Aggregations

Trace (com.enonic.xp.trace.Trace)39 Content (com.enonic.xp.content.Content)6 PortalResponse (com.enonic.xp.portal.PortalResponse)6 Node (com.enonic.xp.node.Node)4 PortalRequest (com.enonic.xp.portal.PortalRequest)4 Site (com.enonic.xp.site.Site)4 DescriptorKey (com.enonic.xp.page.DescriptorKey)3 ContentResolver (com.enonic.xp.portal.impl.ContentResolver)3 ApplicationKey (com.enonic.xp.app.ApplicationKey)2 ContentResolverResult (com.enonic.xp.portal.impl.ContentResolverResult)2 WebResponse (com.enonic.xp.web.WebResponse)2 Matcher (java.util.regex.Matcher)2 Attachment (com.enonic.xp.attachment.Attachment)1 FindContentByParentResult (com.enonic.xp.content.FindContentByParentResult)1 FindContentIdsByQueryResult (com.enonic.xp.content.FindContentIdsByQueryResult)1 Media (com.enonic.xp.content.Media)1 ThrottlingException (com.enonic.xp.exception.ThrottlingException)1 ReadImageParams (com.enonic.xp.image.ReadImageParams)1 ImageOrientation (com.enonic.xp.media.ImageOrientation)1 FindNodesByParentResult (com.enonic.xp.node.FindNodesByParentResult)1