Mako add distributed tracing client (#7180)
* Add support for specifying distributed client tracer in Mako. Introduces a new command line option --distributed_tracer_client. Defaults to disabled, user may specify disabled, log_file, network_lossy, or sim_end. Testing locally and verified with distributed tracing receiver. Note: We use a simple integer here to denote tracer type rather directly using the TracerType enum in flow/Tracing.h. Including Tracing.h pulls in FDBTypes.h and results in conflicts with several classes, including Database.
This commit is contained in:
parent
a43c98519d
commit
7594f5c0f9
|
@ -619,6 +619,19 @@ int workerProcessMain(Arguments const& args, int worker_id, shared_memory::Acces
|
|||
|
||||
selectApiVersion(args.api_version);
|
||||
|
||||
/* enable distributed tracing */
|
||||
switch (args.distributed_tracer_client) {
|
||||
case 1:
|
||||
err = network::setOptionNothrow(FDB_NET_OPTION_DISTRIBUTED_CLIENT_TRACER, BytesRef(toBytePtr("network_lossy")));
|
||||
break;
|
||||
case 2:
|
||||
err = network::setOptionNothrow(FDB_NET_OPTION_DISTRIBUTED_CLIENT_TRACER, BytesRef(toBytePtr("log_file")));
|
||||
break;
|
||||
}
|
||||
if (err) {
|
||||
logr.error("network::setOption(FDB_NET_OPTION_DISTRIBUTED_CLIENT_TRACER): {}", err.what());
|
||||
}
|
||||
|
||||
/* enable flatbuffers if specified */
|
||||
if (args.flatbuffers) {
|
||||
#ifdef FDB_NET_OPTION_USE_FLATBUFFERS
|
||||
|
@ -824,6 +837,7 @@ int initArguments(Arguments& args) {
|
|||
args.json_output_path[0] = '\0';
|
||||
args.bg_materialize_files = false;
|
||||
args.bg_file_path[0] = '\0';
|
||||
args.distributed_tracer_client = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1002,6 +1016,8 @@ void usage() {
|
|||
printf("%-24s %s\n",
|
||||
" --bg_file_path=PATH",
|
||||
"Read blob granule files from the local filesystem at PATH and materialize the results.");
|
||||
printf(
|
||||
"%-24s %s\n", " --distributed_tracer_client=CLIENT", "Specify client (disabled, network_lossy, log_file)");
|
||||
}
|
||||
|
||||
/* parse benchmark paramters */
|
||||
|
@ -1053,6 +1069,7 @@ int parseArguments(int argc, char* argv[], Arguments& args) {
|
|||
{ "disable_ryw", no_argument, NULL, ARG_DISABLE_RYW },
|
||||
{ "json_report", optional_argument, NULL, ARG_JSON_REPORT },
|
||||
{ "bg_file_path", required_argument, NULL, ARG_BG_FILE_PATH },
|
||||
{ "distributed_tracer_client", required_argument, NULL, ARG_DISTRIBUTED_TRACER_CLIENT },
|
||||
{ NULL, 0, NULL, 0 }
|
||||
};
|
||||
idx = 0;
|
||||
|
@ -1240,6 +1257,17 @@ int parseArguments(int argc, char* argv[], Arguments& args) {
|
|||
case ARG_BG_FILE_PATH:
|
||||
args.bg_materialize_files = true;
|
||||
strncpy(args.bg_file_path, optarg, std::min(sizeof(args.bg_file_path), strlen(optarg) + 1));
|
||||
case ARG_DISTRIBUTED_TRACER_CLIENT:
|
||||
if (strcmp(optarg, "disabled") == 0) {
|
||||
args.distributed_tracer_client = 0;
|
||||
} else if (strcmp(optarg, "network_lossy") == 0) {
|
||||
args.distributed_tracer_client = 1;
|
||||
} else if (strcmp(optarg, "log_file") == 0) {
|
||||
args.distributed_tracer_client = 2;
|
||||
} else {
|
||||
args.distributed_tracer_client = -1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1307,6 +1335,10 @@ int validateArguments(Arguments const& args) {
|
|||
return -1;
|
||||
}
|
||||
}
|
||||
if (args.distributed_tracer_client < 0) {
|
||||
logr.error("--disibuted_tracer_client must specify either (disabled, network_lossy, log_file)");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -72,7 +72,8 @@ enum ArgKind {
|
|||
ARG_DISABLE_RYW,
|
||||
ARG_CLIENT_THREADS_PER_VERSION,
|
||||
ARG_JSON_REPORT,
|
||||
ARG_BG_FILE_PATH // if blob granule files are stored locally, mako will read and materialize them if this is set
|
||||
ARG_BG_FILE_PATH, // if blob granule files are stored locally, mako will read and materialize them if this is set
|
||||
ARG_DISTRIBUTED_TRACER_CLIENT
|
||||
};
|
||||
|
||||
constexpr const int OP_COUNT = 0;
|
||||
|
@ -161,6 +162,7 @@ struct Arguments {
|
|||
char json_output_path[PATH_MAX];
|
||||
bool bg_materialize_files;
|
||||
char bg_file_path[PATH_MAX];
|
||||
int distributed_tracer_client;
|
||||
};
|
||||
|
||||
} // namespace mako
|
||||
|
|
Loading…
Reference in New Issue