Search in sources :

Example 6 with TraceNode

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);
}
Also used : TraceNode(com.yahoo.yolean.trace.TraceNode) Test(org.junit.Test)

Example 7 with TraceNode

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();
        }
    }
}
Also used : TraceNode(com.yahoo.yolean.trace.TraceNode) Cursor(com.yahoo.slime.Cursor)

Example 8 with TraceNode

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();
}
Also used : Trace(com.yahoo.processing.execution.Execution.Trace) Query(com.yahoo.search.Query) TraceVisitor(com.yahoo.yolean.trace.TraceVisitor) AtomicReference(java.util.concurrent.atomic.AtomicReference) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) TraceNode(com.yahoo.yolean.trace.TraceNode) Result(com.yahoo.search.Result)

Example 9 with TraceNode

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;
}
Also used : DefaultRenderer(com.yahoo.search.rendering.DefaultRenderer) TraceNode(com.yahoo.yolean.trace.TraceNode) XMLWriter(com.yahoo.text.XMLWriter)

Example 10 with TraceNode

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();
    }
}
Also used : TraceNode(com.yahoo.yolean.trace.TraceNode) XMLWriter(com.yahoo.text.XMLWriter)

Aggregations

TraceNode (com.yahoo.yolean.trace.TraceNode)19 Test (org.junit.Test)11 Query (com.yahoo.search.Query)4 Result (com.yahoo.search.Result)4 JSONString (com.yahoo.prelude.hitfield.JSONString)3 Execution (com.yahoo.search.searchchain.Execution)3 XMLWriter (com.yahoo.text.XMLWriter)3 Trace (com.yahoo.processing.execution.Execution.Trace)1 DefaultRenderer (com.yahoo.search.rendering.DefaultRenderer)1 ArrayTraverser (com.yahoo.slime.ArrayTraverser)1 Cursor (com.yahoo.slime.Cursor)1 Inspector (com.yahoo.slime.Inspector)1 Slime (com.yahoo.slime.Slime)1 TraceVisitor (com.yahoo.yolean.trace.TraceVisitor)1 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 AtomicReference (java.util.concurrent.atomic.AtomicReference)1 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)1