Search in sources :

Example 36 with Trace

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

the class TraceServiceTest method testNewTrace.

@Test
public void testNewTrace() {
    final Trace trace = this.service.newTrace("test", null);
    assertNotNull(trace);
}
Also used : Trace(com.enonic.xp.trace.Trace) Test(org.junit.jupiter.api.Test)

Example 37 with Trace

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

the class NodeServiceImpl method findByQuery.

@Override
public FindNodesByQueryResult findByQuery(final NodeQuery nodeQuery) {
    final Trace trace = Tracer.newTrace("node.findByQuery");
    if (trace == null) {
        return executeFindByQuery(nodeQuery);
    }
    return Tracer.trace(trace, () -> {
        trace.put("query", nodeQuery.getQuery() != null ? nodeQuery.getQuery().toString() : "");
        trace.put("from", nodeQuery.getFrom());
        trace.put("size", nodeQuery.getSize());
        final FindNodesByQueryResult result = executeFindByQuery(nodeQuery);
        trace.put("hits", result.getTotalHits());
        return result;
    });
}
Also used : Trace(com.enonic.xp.trace.Trace) FindNodesByQueryResult(com.enonic.xp.node.FindNodesByQueryResult)

Example 38 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 39 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)

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