Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tag start/end events #33046

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
}

Expand Down
10 changes: 10 additions & 0 deletions searchlib/src/vespa/searchlib/engine/trace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 5 additions & 0 deletions searchlib/src/vespa/searchlib/engine/trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
Loading