Skip to content

Commit

Permalink
bigtrace: Add check for error field in QueryResult proto
Browse files Browse the repository at this point in the history
- Use the error field in QueryResult proto to propagate errors from querying in TraceProcessor instance to Orchestrator

Change-Id: I241d247c39ef9c7c379fd5e29c25bfe4e19c374b
  • Loading branch information
ivan-chong committed Sep 13, 2024
1 parent 97a5d7e commit 2214bd0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion python/perfetto/bigtrace/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def query(self, traces: List[str], sql_query: str):
repeated_batches.extend(result.batch)
iterator = QueryResultIterator(column_names, repeated_batches)
df = iterator.as_pandas_dataframe()
# TODO(ivankc) Investigate whether this is the
# TODO(b/366409021) Investigate whether this is the
# best place to insert these addresses for performance
df.insert(0, '_trace_address', response.trace)
tables.append(df)
Expand Down
9 changes: 9 additions & 0 deletions src/bigtrace/orchestrator/orchestrator_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,15 @@ grpc::Status ExecuteQueryOnTrace(
response.set_trace(trace_response.trace());
for (const protos::QueryResult& query_result : trace_response.result()) {
response.add_result()->CopyFrom(query_result);
if (query_result.has_error()) {
// TODO(b/366410502) Add a mode of operation where some traces are allowed
// to be dropped and a corresponding message is displayed to the user
// alongside partial results
std::lock_guard<std::mutex> status_guard(worker_lock);
query_status = grpc::Status(grpc::StatusCode::INTERNAL,
"[" + trace + "]: " + query_result.error());
break;
}
}
std::lock_guard<std::mutex> buffer_guard(worker_lock);
response_buffer.emplace_back(std::move(response));
Expand Down

0 comments on commit 2214bd0

Please sign in to comment.