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;
});
}
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;
});
}
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);
}
}
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;
}
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));
}
Aggregations