Search in sources :

Example 31 with Trace

use of com.enonic.xp.trace.Trace in project xp by enonic.

the class NodeServiceImpl method findByParent.

@Override
public FindNodesByParentResult findByParent(final FindNodesByParentParams params) {
    final Trace trace = Tracer.newTrace("node.findByParent");
    if (trace == null) {
        return executeFindByParent(params);
    }
    return Tracer.trace(trace, () -> {
        trace.put("parent", params.getParentPath() != null ? params.getParentPath() : params.getParentId());
        trace.put("from", params.getFrom());
        trace.put("size", params.getSize());
        final FindNodesByParentResult result = executeFindByParent(params);
        trace.put("hits", result.getTotalHits());
        return result;
    });
}
Also used : Trace(com.enonic.xp.trace.Trace) FindNodesByParentResult(com.enonic.xp.node.FindNodesByParentResult)

Example 32 with Trace

use of com.enonic.xp.trace.Trace in project xp by enonic.

the class NodeServiceImpl method getByPathAndVersionId.

@Override
public Node getByPathAndVersionId(final NodePath path, final NodeVersionId versionId) {
    final Trace trace = Tracer.newTrace("node.getByPathAndVersionId");
    if (trace == null) {
        return executeGetByPathAndVersionId(path, versionId);
    }
    return Tracer.trace(trace, () -> {
        trace.put("path", path);
        trace.put("versionId", versionId);
        final Node node = executeGetByPathAndVersionId(path, versionId);
        if (node != null) {
            trace.put("id", node.id());
        }
        return node;
    });
}
Also used : Trace(com.enonic.xp.trace.Trace) Node(com.enonic.xp.node.Node)

Example 33 with Trace

use of com.enonic.xp.trace.Trace in project xp by enonic.

the class TaskRunnable method run.

@Override
public void run() {
    setThreadName();
    final Trace trace = Tracer.newTrace("task.run");
    if (trace == null) {
        doRun();
    } else {
        trace.put("taskId", id);
        trace.put("user", runnableTask.getTaskContext().getAuthInfo().getUser() != null ? runnableTask.getTaskContext().getAuthInfo().getUser().getKey() : PrincipalKey.ofAnonymous());
        trace.put("app", runnableTask.getApplicationKey());
        Tracer.trace(trace, this::doRun);
    }
}
Also used : Trace(com.enonic.xp.trace.Trace)

Example 34 with Trace

use of com.enonic.xp.trace.Trace in project xp by enonic.

the class PostProcessingRenderer method executeResponseProcessors.

private PortalResponse executeResponseProcessors(final PortalRequest portalRequest, final PortalResponse portalResponse) {
    final ResponseProcessorDescriptors filters = this.processorChainResolver.resolve(portalRequest);
    if (!portalResponse.applyFilters() || filters.isEmpty()) {
        return portalResponse;
    }
    PortalResponse filterResponse = portalResponse;
    for (ResponseProcessorDescriptor filter : filters) {
        final PortalResponse filterPortalResponse = filterResponse;
        final Trace trace = Tracer.newTrace("renderFilter");
        if (trace == null) {
            filterResponse = processorExecutor.execute(filter, portalRequest, filterPortalResponse);
        } else {
            trace.put("app", filter.getApplication().toString());
            trace.put("name", filter.getName());
            trace.put("type", "filter");
            filterResponse = Tracer.trace(trace, () -> processorExecutor.execute(filter, portalRequest, filterPortalResponse));
        }
        if (!filterResponse.applyFilters()) {
            break;
        }
    }
    return filterResponse;
}
Also used : Trace(com.enonic.xp.trace.Trace) PortalResponse(com.enonic.xp.portal.PortalResponse) ResponseProcessorDescriptor(com.enonic.xp.site.processor.ResponseProcessorDescriptor) ResponseProcessorDescriptors(com.enonic.xp.site.processor.ResponseProcessorDescriptors)

Example 35 with Trace

use of com.enonic.xp.trace.Trace in project xp by enonic.

the class ComponentInstruction method renderComponent.

private PortalResponse renderComponent(final PortalRequest portalRequest, final Component component) {
    final Trace trace = Tracer.newTrace("renderComponent");
    if (trace == null) {
        return rendererDelegate.render(component, portalRequest);
    }
    trace.put("componentPath", component.getPath());
    trace.put("type", component.getType().toString());
    return Tracer.trace(trace, () -> rendererDelegate.render(component, portalRequest));
}
Also used : Trace(com.enonic.xp.trace.Trace)

Aggregations

Trace (com.enonic.xp.trace.Trace)37 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