add query history trace.