diff --git a/bindings/go/src/fdb/generated.go b/bindings/go/src/fdb/generated.go index c42757d677..aea915cb22 100644 --- a/bindings/go/src/fdb/generated.go +++ b/bindings/go/src/fdb/generated.go @@ -92,6 +92,13 @@ func (o NetworkOptions) SetTraceLogGroup(param string) error { return o.setOpt(33, []byte(param)) } +// Selects trace output format for this client. xml (the default) and json are supported. +// +// Parameter: trace format +func (o NetworkOptions) SetTraceFormat(param string) error { + return o.setOpt(34, []byte(param)) +} + // Set internal tuning or debugging knobs // // Parameter: knob_name=knob_value diff --git a/documentation/sphinx/source/api-common.rst.inc b/documentation/sphinx/source/api-common.rst.inc index 6052c382fc..75ed4f62cd 100644 --- a/documentation/sphinx/source/api-common.rst.inc +++ b/documentation/sphinx/source/api-common.rst.inc @@ -232,6 +232,9 @@ .. |option-trace-roll-size-blurb| replace:: Sets the maximum size in bytes of a single trace output file for this FoundationDB client. +.. |option-trace-format-blurb| replace:: + Select the format of the trace files for this FoundationDB client. xml (the default) and json are supported. + .. |network-options-warning| replace:: It is an error to set these options after the first call to |open-func| anywhere in your application. diff --git a/documentation/sphinx/source/api-python.rst b/documentation/sphinx/source/api-python.rst index ed0e93fdf8..11f04d652a 100644 --- a/documentation/sphinx/source/api-python.rst +++ b/documentation/sphinx/source/api-python.rst @@ -117,6 +117,10 @@ After importing the ``fdb`` module and selecting an API version, you probably wa |option-trace-roll-size-blurb| + .. method :: fdb.options.set_trace_format(format) + + |option-trace-format-blurb| + .. method :: fdb.options.set_disable_multi_version_client_api() |option-disable-multi-version-client-api| diff --git a/documentation/sphinx/source/api-ruby.rst b/documentation/sphinx/source/api-ruby.rst index ef3c33f423..b8c5a8cdc3 100644 --- a/documentation/sphinx/source/api-ruby.rst +++ b/documentation/sphinx/source/api-ruby.rst @@ -104,6 +104,10 @@ After requiring the ``FDB`` gem and selecting an API version, you probably want |option-trace-roll-size-blurb| + .. method:: FDB.options.set_trace_format(format) -> nil + + |option-trace-format-blurb| + |option-disable-multi-version-client-api| .. method :: FDB.options.set_callbacks_on_external_threads() -> nil diff --git a/fdbclient/NativeAPI.actor.cpp b/fdbclient/NativeAPI.actor.cpp index 75ef0c9727..3378394449 100644 --- a/fdbclient/NativeAPI.actor.cpp +++ b/fdbclient/NativeAPI.actor.cpp @@ -743,6 +743,7 @@ void Cluster::init( Reference connFile, bool startClientI initTraceEventMetrics(); auto publicIP = determinePublicIPAutomatically( connFile->getConnectionString() ); + selectTraceFormatter(networkOptions.traceFormat); openTraceFile(NetworkAddress(publicIP, ::getpid()), networkOptions.traceRollSize, networkOptions.traceMaxLogsSize, networkOptions.traceDirectory.get(), "trace", networkOptions.traceLogGroup); TraceEvent("ClientStart") @@ -795,6 +796,14 @@ void setNetworkOption(FDBNetworkOptions::Option option, Optional valu if(value.present()) networkOptions.traceLogGroup = value.get().toString(); break; + case FDBNetworkOptions::TRACE_FORMAT: + validateOptionValue(value, true); + networkOptions.traceFormat = value.get().toString(); + if (!validateTraceFormat(networkOptions.traceFormat)) { + fprintf(stderr, "Unrecognized trace format: `%s'\n", networkOptions.traceFormat.c_str()); + throw invalid_option_value(); + } + break; case FDBNetworkOptions::KNOB: { validateOptionValue(value, true); diff --git a/fdbclient/NativeAPI.h b/fdbclient/NativeAPI.h index a64a6d1381..1c55751552 100644 --- a/fdbclient/NativeAPI.h +++ b/fdbclient/NativeAPI.h @@ -47,14 +47,16 @@ struct NetworkOptions { uint64_t traceRollSize; uint64_t traceMaxLogsSize; std::string traceLogGroup; + std::string traceFormat; Optional logClientInfo; Standalone> supportedVersions; bool slowTaskProfilingEnabled; // The default values, TRACE_DEFAULT_ROLL_SIZE and TRACE_DEFAULT_MAX_LOGS_SIZE are located in Trace.h. - NetworkOptions() : localAddress(""), clusterFile(""), traceDirectory(Optional()), traceRollSize(TRACE_DEFAULT_ROLL_SIZE), traceMaxLogsSize(TRACE_DEFAULT_MAX_LOGS_SIZE), traceLogGroup("default"), - slowTaskProfilingEnabled(false) - { } + NetworkOptions() + : localAddress(""), clusterFile(""), traceDirectory(Optional()), + traceRollSize(TRACE_DEFAULT_ROLL_SIZE), traceMaxLogsSize(TRACE_DEFAULT_MAX_LOGS_SIZE), traceLogGroup("default"), + traceFormat("xml"), slowTaskProfilingEnabled(false) {} }; class Database { diff --git a/fdbclient/vexillographer/fdb.options b/fdbclient/vexillographer/fdb.options index 6d5d11bc90..d3161632b1 100644 --- a/fdbclient/vexillographer/fdb.options +++ b/fdbclient/vexillographer/fdb.options @@ -48,6 +48,9 @@ description is not currently required but encouraged.