summaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorHÃ¥vard Pettersen <3535158+havardpe@users.noreply.github.com>2023-02-10 11:26:48 +0100
committerGitHub <noreply@github.com>2023-02-10 11:26:48 +0100
commit3d5e5a56b7aed8315726b203117a2b6bc2dd0d31 (patch)
tree684d2a8634f589b1c3439e6a179d59ce1e68acb9 /searchcore
parent6cafa7d885b5e0fe2ca7e33a786d0fa79d0e48ff (diff)
parent37391e9cb5b375a5a8c1c4acc21a10805cb2f5e0 (diff)
Merge pull request #25967 from vespa-engine/havardpe/trace-global-filter-iterator-tree
trace global filter iterator tree
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/match_master.cpp19
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp5
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp12
3 files changed, 8 insertions, 28 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_master.cpp b/searchcore/src/vespa/searchcore/proton/matching/match_master.cpp
index 4450b34296b..3a43e9a118e 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/match_master.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/match_master.cpp
@@ -24,20 +24,7 @@ using vespalib::Issue;
namespace {
-struct LazyThreadTraceInserter {
- search::engine::Trace &root_trace;
- std::unique_ptr<vespalib::slime::Inserter> inserter;
- LazyThreadTraceInserter(search::engine::Trace &root_trace_in)
- : root_trace(root_trace_in), inserter() {}
- void handle(const search::engine::Trace &thread_trace) {
- if (thread_trace.hasTrace()) {
- if (!inserter) {
- inserter = std::make_unique<vespalib::slime::ArrayInserter>(root_trace.createCursor("query_execution").setArray("threads"));
- }
- vespalib::slime::inject(thread_trace.getRoot(), *inserter);
- }
- }
-};
+using namespace vespalib::literals;
struct TimedMatchLoopCommunicator final : IMatchLoopCommunicator {
IMatchLoopCommunicator &communicator;
@@ -116,12 +103,12 @@ MatchMaster::match(search::engine::Trace & trace,
double query_time_s = vespalib::to_s(query_latency_time.elapsed());
double rerank_time_s = vespalib::to_s(timedCommunicator.elapsed);
double match_time_s = 0.0;
- LazyThreadTraceInserter inserter(trace);
+ auto inserter = trace.make_inserter("query_execution"_ssv);
for (size_t i = 0; i < threadState.size(); ++i) {
const MatchThread & matchThread = *threadState[i];
match_time_s = std::max(match_time_s, matchThread.get_match_time());
_stats.merge_partition(matchThread.get_thread_stats(), i);
- inserter.handle(matchThread.getTrace());
+ inserter.handle_thread(matchThread.getTrace());
matchThread.get_issues().for_each_message([](const auto &msg){ Issue::report(Issue(msg)); });
}
_stats.queryLatency(query_time_s);
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp b/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp
index 620e4f1ff1d..acbd069aac7 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp
@@ -420,15 +420,12 @@ MatchThread::MatchThread(size_t thread_id_in,
match_time_s(0.0),
wait_time_s(0.0),
match_with_ranking(mtf.has_first_phase_rank() && mp.save_rank_scores()),
- trace(std::make_unique<Trace>(parent_trace.getRelativeTime(), parent_trace.getLevel())),
+ trace(parent_trace.make_trace_up()),
match_profiler(),
first_phase_profiler(),
second_phase_profiler(),
my_issues()
{
- trace->match_profile_depth(parent_trace.match_profile_depth());
- trace->first_phase_profile_depth(parent_trace.first_phase_profile_depth());
- trace->second_phase_profile_depth(parent_trace.second_phase_profile_depth());
if (trace->getLevel() > 0) {
if (int32_t depth = trace->match_profile_depth(); depth != 0) {
match_profiler = std::make_unique<vespalib::ExecutionProfiler>(depth);
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp b/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp
index 834e256c18f..ef9606f96a8 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp
@@ -36,6 +36,8 @@ using search::fef::Properties;
using search::fef::RankSetup;
using search::fef::IIndexEnvironment;
+using namespace vespalib::literals;
+
bool contains_all(const HandleRecorder::HandleMap &old_map,
const HandleRecorder::HandleMap &new_map)
{
@@ -187,10 +189,7 @@ MatchToolsFactory(QueryLimiter & queryLimiter,
_diversityParams(),
_valid(false)
{
- search::engine::Trace trace(root_trace.getRelativeTime(), root_trace.getLevel());
- trace.match_profile_depth(root_trace.match_profile_depth());
- trace.first_phase_profile_depth(root_trace.first_phase_profile_depth());
- trace.second_phase_profile_depth(root_trace.second_phase_profile_depth());
+ auto trace = root_trace.make_trace();
trace.addEvent(4, "Start query setup");
_query.setWhiteListBlueprint(metaStore.createWhiteListBlueprint());
trace.addEvent(5, "Deserialize and build query tree");
@@ -231,10 +230,7 @@ MatchToolsFactory(QueryLimiter & queryLimiter,
_match_limiter = std::make_unique<NoMatchPhaseLimiter>();
}
trace.addEvent(4, "Complete query setup");
- if (trace.hasTrace()) {
- vespalib::slime::ObjectInserter inserter(root_trace.createCursor("query_setup"), "traces");
- vespalib::slime::inject(trace.getTraces(), inserter);
- }
+ root_trace.make_inserter("query_setup"_ssv).handle_nested(trace);
}
MatchToolsFactory::~MatchToolsFactory() = default;