TraceProcessor RPC: Add API version to handle version mismatch
This CL adds a notion of API version to the TraceProcessor
RPC protocol. This is to deal with cases where we introduce
a new TP feature (a new table, a new operator) that the UI
depends on.
Today the UI breaks in unexpected ways when the user is using
a version of trace_processor_shell --http that is too old.
This change makes it more explicit, telling the user what to do.
Preview: https://imgur.com/a/Jvap5K2
Bug: 159142289
Change-Id: Ic2d68f94c7eb7bd5b95eabd842dae71fe61222d4
diff --git a/src/trace_processor/trace_processor_shell.cc b/src/trace_processor/trace_processor_shell.cc
index 9db56c4..6925948 100644
--- a/src/trace_processor/trace_processor_shell.cc
+++ b/src/trace_processor/trace_processor_shell.cc
@@ -45,6 +45,8 @@
#include "src/trace_processor/util/proto_to_json.h"
#include "src/trace_processor/util/status_macros.h"
+#include "protos/perfetto/trace_processor/trace_processor.pbzero.h"
+
#if PERFETTO_BUILDFLAG(PERFETTO_TP_HTTPD)
#include "src/trace_processor/rpc/httpd.h"
#endif
@@ -756,6 +758,8 @@
if (option == 'v') {
printf("%s\n", base::GetVersionString());
+ printf("Trace Processor RPC API version: %d\n",
+ protos::pbzero::TRACE_PROCESSOR_CURRENT_API_VERSION);
exit(0);
}