use of com.enonic.xp.trace.Trace in project xp by enonic.
the class ContentServiceImpl method getByPath.
@Override
public Content getByPath(final ContentPath path) {
final Trace trace = Tracer.newTrace("content.getByPath");
if (trace == null) {
return doGetByPath(path);
}
return Tracer.trace(trace, () -> {
trace.put("path", path);
final Content content = doGetByPath(path);
trace.put("id", content.getId());
return content;
});
}
use of com.enonic.xp.trace.Trace in project xp by enonic.
the class ContentServiceImpl method find.
@Override
public FindContentIdsByQueryResult find(final ContentQuery query) {
final Trace trace = Tracer.newTrace("content.find");
if (trace == null) {
return doFind(query);
}
return Tracer.trace(trace, () -> {
trace.put("query", query.getQueryExpr() != null ? query.getQueryExpr().toString() : "");
trace.put("from", query.getFrom());
trace.put("size", query.getSize());
final FindContentIdsByQueryResult result = doFind(query);
trace.put("hits", result.getTotalHits());
return result;
});
}
use of com.enonic.xp.trace.Trace in project xp by enonic.
the class ContentServiceImpl method getNearestSite.
@Override
public Site getNearestSite(final ContentId contentId) {
final Trace trace = Tracer.newTrace("content.getNearestSite");
if (trace == null) {
return doGetNearestSite(contentId);
}
return Tracer.trace(trace, () -> {
trace.put("id", contentId);
final Site site = doGetNearestSite(contentId);
if (site != null) {
trace.put("path", site.getPath());
}
return site;
});
}
use of com.enonic.xp.trace.Trace in project xp by enonic.
the class ContentServiceImpl method getByIdAndVersionId.
@Override
public Content getByIdAndVersionId(final ContentId contentId, final ContentVersionId versionId) {
final Trace trace = Tracer.newTrace("content.getByIdAndVersionId");
if (trace == null) {
return doGetByIdAndVersionId(contentId, versionId);
}
return Tracer.trace(trace, () -> {
trace.put("contentId", contentId);
trace.put("versionId", versionId);
final Content content = doGetByIdAndVersionId(contentId, versionId);
if (content != null) {
trace.put("path", content.getPath());
}
return content;
});
}
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);
}
Aggregations