use of com.yahoo.yolean.trace.TraceNode in project vespa by vespa-engine.
the class SlimeTraceSerializerTest method assertSerialize.
private void assertSerialize(TraceNode root) {
Slime slime = new Slime();
SlimeTraceSerializer serializer = new SlimeTraceSerializer(slime.setObject());
root.accept(serializer);
SlimeTraceDeserializer deserializer = new SlimeTraceDeserializer(slime.get());
TraceNode deser = deserializer.deserialize();
assertTraceEqual(deser, root);
}
use of com.yahoo.yolean.trace.TraceNode in project vespa by vespa-engine.
the class SyncDefaultRenderer method queryContext.
public void queryContext(XMLWriter writer, QueryContext queryContext, Query owner) throws IOException {
try {
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();
}
} catch (Exception e) {
handleException(e);
}
}
use of com.yahoo.yolean.trace.TraceNode in project vespa by vespa-engine.
the class JsonRendererTestCase method testTracingOfNodesWithBothChildrenAndData.
@Test
public final void testTracingOfNodesWithBothChildrenAndData() throws IOException, InterruptedException, ExecutionException {
String expected = "{\n" + " \"root\": {\n" + " \"fields\": {\n" + " \"totalCount\": 0\n" + " },\n" + " \"id\": \"toplevel\",\n" + " \"relevance\": 1.0\n" + " },\n" + " \"trace\": {\n" + " \"children\": [\n" + " {\n" + " \"message\": \"No query profile is used\"\n" + " },\n" + " {\n" + " \"children\": [\n" + " {\n" + " \"message\": \"string payload\",\n" + " \"children\": [" + " {\n" + " \"message\": \"leafnode\"" + " }\n" + " ]\n" + " },\n" + " {\n" + " \"message\": \"something\"\n" + " }\n" + " ]\n" + " }\n" + " ]\n" + " }\n" + "}\n";
Query q = new Query("/?query=a&tracelevel=1");
Execution execution = new Execution(Execution.Context.createContextStub());
Result r = new Result(q);
execution.search(q);
final TraceNode child = new TraceNode("string payload", 0L);
child.add(new TraceNode("leafnode", 0L));
execution.trace().traceNode().add(child);
q.trace("something", 1);
String summary = render(execution, r);
assertEqualJson(expected, summary);
}
use of com.yahoo.yolean.trace.TraceNode in project vespa by vespa-engine.
the class JsonRendererTestCase method testTracingOfNodesWithBothChildrenAndDataAndEmptySubnode.
@Test
public final void testTracingOfNodesWithBothChildrenAndDataAndEmptySubnode() throws IOException, InterruptedException, ExecutionException {
String expected = "{\n" + " \"root\": {\n" + " \"fields\": {\n" + " \"totalCount\": 0\n" + " },\n" + " \"id\": \"toplevel\",\n" + " \"relevance\": 1.0\n" + " },\n" + " \"trace\": {\n" + " \"children\": [\n" + " {\n" + " \"message\": \"No query profile is used\"\n" + " },\n" + " {\n" + " \"children\": [\n" + " {\n" + " \"message\": \"string payload\"\n" + " },\n" + " {\n" + " \"message\": \"something\"\n" + " }\n" + " ]\n" + " }\n" + " ]\n" + " }\n" + "}\n";
Query q = new Query("/?query=a&tracelevel=1");
Execution execution = new Execution(Execution.Context.createContextStub());
Result r = new Result(q);
execution.search(q);
final TraceNode child = new TraceNode("string payload", 0L);
child.add(new TraceNode(null, 0L));
execution.trace().traceNode().add(child);
q.trace("something", 1);
String summary = render(execution, r);
assertEqualJson(expected, summary);
}
Aggregations