diff --git a/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.cpp b/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.cpp index 55cc84107f1..97c94926f23 100644 --- a/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.cpp +++ b/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.cpp @@ -138,7 +138,9 @@ MatchEngine::doSearch(const SearchRequest & searchRequest) { searchRequest.maxhits, searchRequest.offset, searchRequest.sortSpec.empty() ? "" : " (with sorting)", - searchRequest.groupSpec.empty() ? "" : " (with grouping)")); + searchRequest.groupSpec.empty() ? "" : " (with grouping)"), + "query_start"); + ISearchHandler::SP searchHandler; auto threadBundle = _threadBundlePool.getBundle(); { // try to find the match handler corresponding to the specified search doc type @@ -164,7 +166,8 @@ MatchEngine::doSearch(const SearchRequest & searchRequest) { } searchRequest.trace().addEvent(4, vespalib::make_string("returning %zu hits from total %" PRIu64, - ret->hits.size(), ret->totalHitCount)); + ret->hits.size(), ret->totalHitCount), + "query_reply"); return ret; } diff --git a/searchlib/src/vespa/searchlib/engine/trace.cpp b/searchlib/src/vespa/searchlib/engine/trace.cpp index 134245fb2c0..8d3ecd2980c 100644 --- a/searchlib/src/vespa/searchlib/engine/trace.cpp +++ b/searchlib/src/vespa/searchlib/engine/trace.cpp @@ -126,6 +126,16 @@ Trace::addEvent(uint32_t level, std::string_view event) { trace.setString("event", event); } +void +Trace::addEvent(uint32_t level, std::string_view event, std::string_view tag) { + if (!shouldTrace(level)) { return; } + + Cursor & trace = traces().addObject(); + addTimeStamp(trace); + trace.setString("event", event); + trace.setString("tag", tag); +} + void Trace::addTimeStamp(Cursor & trace) { trace.setDouble("timestamp_ms", vespalib::count_ns(_relativeTime.timeSinceDawn())/1000000.0); diff --git a/searchlib/src/vespa/searchlib/engine/trace.h b/searchlib/src/vespa/searchlib/engine/trace.h index 6a2ab148fc9..6c88731d5d6 100644 --- a/searchlib/src/vespa/searchlib/engine/trace.h +++ b/searchlib/src/vespa/searchlib/engine/trace.h @@ -101,6 +101,11 @@ class Trace */ void addEvent(uint32_t level, std::string_view event); + /** + * Will add an 'event' string, with timestamp and tag + */ + void addEvent(uint32_t level, std::string_view event, std::string_view tag); + /** * Will compute and and a final duration timing. */