use of com.yahoo.yolean.trace.TraceNode in project vespa by vespa-engine.
the class SlimeTraceSerializerTest method test_long.
@Test
public void test_long() throws IOException {
TraceNode root = new TraceNode(14L, 5);
assertThat(toJson(root), is("{\"timestamp\":5,\"payload\":14}"));
assertSerialize(root);
}
use of com.yahoo.yolean.trace.TraceNode in project vespa by vespa-engine.
the class SlimeTraceSerializer method addChildrenCursors.
private void addChildrenCursors(Cursor current, TraceNode node) {
Iterator<TraceNode> it = node.children().iterator();
if (it.hasNext()) {
Cursor childrenArray = current.setArray(CHILDREN);
while (it.hasNext()) {
cursors.push(childrenArray.addObject());
it.next();
}
}
}
use of com.yahoo.yolean.trace.TraceNode in project vespa by vespa-engine.
the class FastSearcherTestCase method getTraceString.
private String getTraceString(String summary) {
FastSearcher fastSearcher = createFastSearcher();
Query query = new Query("?query=ignored");
query.getPresentation().setSummary(summary);
query.setTraceLevel(2);
Result result = doSearch(fastSearcher, query, 0, 10);
doFill(fastSearcher, result);
Trace trace = query.getContext(false).getTrace();
final AtomicReference<String> fillTraceString = new AtomicReference<>();
trace.traceNode().accept(new TraceVisitor() {
@Override
public void visit(TraceNode traceNode) {
if (traceNode.payload() instanceof String && traceNode.payload().toString().contains("fill to dispatch"))
fillTraceString.set((String) traceNode.payload());
}
});
return fillTraceString.get();
}
use of com.yahoo.yolean.trace.TraceNode in project vespa by vespa-engine.
the class QueryContext method render.
public boolean render(Writer writer) throws java.io.IOException {
if (owner.getTraceLevel() != 0) {
XMLWriter xmlWriter = XMLWriter.from(writer);
xmlWriter.openTag("meta").attribute("type", ID);
TraceNode traceRoot = owner.getModel().getExecution().trace().traceNode().root();
traceRoot.accept(new DefaultRenderer.RenderingVisitor(xmlWriter, owner.getStartTime()));
xmlWriter.closeTag();
}
return true;
}
use of com.yahoo.yolean.trace.TraceNode in project vespa by vespa-engine.
the class DefaultRenderer method queryContext.
@SuppressWarnings("UnusedParameters")
public void queryContext(XMLWriter writer, QueryContext queryContext, Query owner) throws IOException {
if (owner.getTraceLevel() != 0) {
XMLWriter xmlWriter = XMLWriter.from(writer);
xmlWriter.openTag("meta").attribute("type", QueryContext.ID);
TraceNode traceRoot = owner.getModel().getExecution().trace().traceNode().root();
traceRoot.accept(new RenderingVisitor(xmlWriter, owner.getStartTime()));
xmlWriter.closeTag();
}
}
Aggregations