Add `babeltrace.` prefix to `trace-info` and `support-info` query objects
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 25 Jul 2019 16:47:00 +0000 (12:47 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Fri, 26 Jul 2019 23:19:09 +0000 (19:19 -0400)
The `trace-info` and `support-info` query objects are supported by the
project's plugins, the project's Python bindings, and the project's CLI.
To avoid name clashes with third-party query objects, prepend
`babeltrace.` to the object names as a namespace.

The dot notation is not standardized in any way here: it is an arbitrary
format that the project chooses. We don't necessarily expect third-party
developers to follow this scheme.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I6aec9bf24f7a8a41796c3a1e84d982c99be6aee5
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1783
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
doc/man/babeltrace2-convert.1.txt
doc/man/babeltrace2-query.1.txt
doc/man/babeltrace2-source.ctf.fs.7.txt
src/bindings/python/bt2/bt2/trace_collection_message_iterator.py
src/cli/babeltrace2-cfg-cli-args.c
src/cli/babeltrace2-cfg-src-auto-disc.c
src/cli/babeltrace2.c
src/plugins/ctf/fs-src/fs.c
tests/data/cli/auto-source-discovery/bt_plugin_test.py
tests/plugins/src.ctf.fs/query/test_query_trace_info.py

index 1bf554f005108cae5b50f7fa5aa27d54bf759534..ad196de0525cb5834848daba5ba1a240e6cfb54a 100644 (file)
@@ -833,8 +833,8 @@ opt:--stream-intersection::
 +
 All the source components, <<comp-create-expl,explicit>> and
 <<comp-create-impl,implicit>>, must have classes which support the
-`trace-info` query object to use this option. The only Babeltrace
-project's component class which supports this query object is
+`babeltrace.trace-info` query object to use this option. The only
+Babeltrace project's component class which supports this query object is
 compcls:source.ctf.fs.
 +
 Because it is not possible to replicate with a single
index d5483b97fbe1c6a486ab0c033f6619f517603c67..11a78dc08ceb5e5b392846544ab99cfb4ec8ab7b 100644 (file)
@@ -101,8 +101,8 @@ $ babeltrace2 query src.ctf.fs metadata-info \
 ====
 [role="term"]
 ----
-$ babeltrace2 query src.ctf.fs trace-info \
-                   --params='path="/path/to/trace"'
+$ babeltrace2 query src.ctf.fs babeltrace.trace-info \
+                    --params='path="/path/to/trace"'
 ----
 ====
 
index 8fafb076f6231a57daf87b6ae686216ccdf3f248..193199173668dd9433785941e7856d4b8982646b 100644 (file)
@@ -165,11 +165,11 @@ Returned object (map):
     True if the metadata stream is packetized.
 
 
-`trace-info`
-~~~~~~~~~~~~
-You can query the `trace-info` object for a set of CTF traces to get
-information about the data streams they contain, their intersection time
-range, and more.
+`babeltrace.trace-info`
+~~~~~~~~~~~~~~~~~~~~~~~
+You can query the `babeltrace.trace-info` object for a set of CTF traces
+to get information about the data streams they contain, their
+intersection time range, and more.
 
 This query object requires that the processed CTF traces have the
 `timestamp_begin` and `timestamp_end` fields in their packet context
index 06318a9c9af467fa6a654cfe7a3b1ff25bc5c2f9..f7b819d9af1c59c6579abd855fe5ca66f944a94f 100644 (file)
@@ -157,12 +157,12 @@ class TraceCollectionMessageIterator(bt2_message_iterator._MessageIterator):
 
         params = {'inputs': inputs}
 
-        # query the port's component for the `trace-info` object which
-        # contains the stream intersection range for each exposed
-        # trace
+        # query the port's component for the `babeltrace.trace-info`
+        # object which contains the stream intersection range for each
+        # exposed trace
         query_exec = bt2.QueryExecutor()
         trace_info_res = query_exec.query(
-            src_comp_and_spec.comp.cls, 'trace-info', params
+            src_comp_and_spec.comp.cls, 'babeltrace.trace-info', params
         )
         begin = None
         end = None
index a16fbfceaa4b6d2cff737bddd1eee9ba374c7b4d..8bf2c25439ddeaf33e41cf2e40f484e36a209080 100644 (file)
@@ -4052,8 +4052,8 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
                        break;
                case OPT_STREAM_INTERSECTION:
                        /*
-                        * Applies to all traces implementing the trace-info
-                        * query.
+                        * Applies to all traces implementing the
+                        * babeltrace.trace-info query.
                         */
                        stream_intersection_mode = true;
                        break;
index 6b1b45635dca0fc813077cac11ca36c3258f83df..22aae2dafedcfe7f49417cdf0a7ce95a1b4831eb 100644 (file)
@@ -196,7 +196,7 @@ int convert_weight_value(const bt_value *weight_value, double *weight,
                /* Accept signed integer as a convenience for "return 0" or "return 1" in Python. */
                *weight = bt_value_integer_signed_get(weight_value);
        } else {
-               BT_LOGW("support-info query: unexpected type for weight: "
+               BT_LOGW("babeltrace.support-info query: unexpected type for weight: "
                        "component-class-name=source.%s.%s, input=%s, input-type=%s, "
                        "expected-entry-type=%s, actual-entry-type=%s",
                        plugin_name, source_cc_name, input, input_type,
@@ -206,7 +206,7 @@ int convert_weight_value(const bt_value *weight_value, double *weight,
        }
 
        if (*weight < 0.0 || *weight > 1.0) {
-               BT_LOGW("support-info query: weight value is out of range [0.0, 1.0]: "
+               BT_LOGW("babeltrace.support-info query: weight value is out of range [0.0, 1.0]: "
                        "component-class-name=source.%s.%s, input=%s, input-type=%s, "
                        "weight=%f",
                        plugin_name, source_cc_name, input, input_type, *weight);
@@ -315,11 +315,11 @@ int support_info_query_all_sources(const char *input,
                                continue;
                        }
 
-                       BT_LOGD("support-info query: before: component-class-name=source.%s.%s, input=%s, "
+                       BT_LOGD("babeltrace.support-info query: before: component-class-name=source.%s.%s, input=%s, "
                                "type=%s", plugin_name, source_cc_name, input, input_type);
 
                        BT_VALUE_PUT_REF_AND_RESET(query_result);
-                       query_status = bt_query_executor_query(query_executor, cc, "support-info",
+                       query_status = bt_query_executor_query(query_executor, cc, "babeltrace.support-info",
                                query_params, log_level, &query_result);
 
                        if (query_status == BT_QUERY_EXECUTOR_QUERY_STATUS_OK) {
@@ -340,7 +340,7 @@ int support_info_query_all_sources(const char *input,
                                        const bt_value *weight_value;
 
                                        if (!bt_value_map_has_entry(query_result, "weight")) {
-                                               BT_LOGW("support-info query: result is missing `weight` entry: "
+                                               BT_LOGW("babeltrace.support-info query: result is missing `weight` entry: "
                                                        "component-class-name=source.%s.%s, input=%s, input-type=%s",
                                                        bt_plugin_get_name(plugin),
                                                        bt_component_class_get_name(cc), input,
@@ -368,7 +368,7 @@ int support_info_query_all_sources(const char *input,
                                                        /* Do as if no value was passed. */
                                                        group_value = NULL;
                                                } else if (bt_value_get_type(group_value) != BT_VALUE_TYPE_STRING) {
-                                                       BT_LOGW("support-info query: unexpected type for entry `group`: "
+                                                       BT_LOGW("babeltrace.support-info query: unexpected type for entry `group`: "
                                                                "component-class-name=source.%s.%s, input=%s, input-type=%s, "
                                                                "expected-entry-type=%s,%s, actual-entry-type=%s",
                                                                bt_plugin_get_name(plugin),
@@ -381,7 +381,7 @@ int support_info_query_all_sources(const char *input,
                                                }
                                        }
                                } else {
-                                       BT_LOGW("support-info query: unexpected result type: "
+                                       BT_LOGW("babeltrace.support-info query: unexpected result type: "
                                                "component-class-name=source.%s.%s, input=%s, input-type=%s, "
                                                "expected-types=%s,%s,%s, actual-type=%s",
                                                bt_plugin_get_name(plugin),
@@ -394,7 +394,7 @@ int support_info_query_all_sources(const char *input,
                                        continue;
                                }
 
-                               BT_LOGD("support-info query: success: component-class-name=source.%s.%s, input=%s, "
+                               BT_LOGD("babeltrace.support-info query: success: component-class-name=source.%s.%s, input=%s, "
                                        "type=%s, weight=%f\n",
                                        bt_plugin_get_name(plugin), bt_component_class_get_name(cc), input,
                                        input_type, weight);
@@ -410,13 +410,13 @@ int support_info_query_all_sources(const char *input,
                                        winner.weigth = weight;
                                }
                        } else if (query_status == BT_QUERY_EXECUTOR_QUERY_STATUS_ERROR) {
-                               BT_CLI_LOGE_APPEND_CAUSE("support-info query failed.");
+                               BT_CLI_LOGE_APPEND_CAUSE("babeltrace.support-info query failed.");
                                goto error;
                        } else if (query_status == BT_QUERY_EXECUTOR_QUERY_STATUS_MEMORY_ERROR) {
                                BT_CLI_LOGE_APPEND_CAUSE("Memory error.");
                                goto error;
                        } else {
-                               BT_LOGD("support-info query: failure: component-class-name=source.%s.%s, input=%s, "
+                               BT_LOGD("babeltrace.support-info query: failure: component-class-name=source.%s.%s, input=%s, "
                                        "type=%s, status=%s\n",
                                        bt_plugin_get_name(plugin), bt_component_class_get_name(cc), input,
                                        input_type,
index 8301fba870d676097e90a7f51427bcd97ef6c997..12d9cc0cadfd2154e9626be899c182b346d015a2 100644 (file)
@@ -1884,11 +1884,11 @@ int set_stream_intersections(struct cmd_run_ctx *ctx,
        const bt_component_class *comp_cls =
                bt_component_class_source_as_component_class_const(src_comp_cls);
 
-       ret = query(ctx->cfg, comp_cls, "trace-info",
+       ret = query(ctx->cfg, comp_cls, "babeltrace.trace-info",
                cfg_comp->params, &query_result,
                &fail_reason);
        if (ret) {
-               BT_LOGD("Component class does not support the `trace-info` query: %s: "
+               BT_LOGD("Component class does not support the `babeltrace.trace-info` query: %s: "
                        "comp-class-name=\"%s\"", fail_reason,
                        bt_component_class_get_name(comp_cls));
                ret = -1;
@@ -1898,7 +1898,7 @@ int set_stream_intersections(struct cmd_run_ctx *ctx,
        BT_ASSERT(query_result);
 
        if (!bt_value_is_array(query_result)) {
-               BT_LOGD("Unexpected format of \'trace-info\' query result: "
+               BT_LOGD("Unexpected format of `babeltrace.trace-info` query result: "
                        "component-class-name=%s",
                        bt_component_class_get_name(comp_cls));
                ret = -1;
index 1ff98131c01d6b2fcff7a585a2b7dd98106c1188..965a9ee8782ea6f66d4eea64e4fed19f04b3313d 100644 (file)
@@ -2000,10 +2000,10 @@ bt_component_class_query_method_status ctf_fs_query(
        if (strcmp(object, "metadata-info") == 0) {
                status = metadata_info_query(comp_class, params, log_level,
                        result);
-       } else if (strcmp(object, "trace-info") == 0) {
+       } else if (strcmp(object, "babeltrace.trace-info") == 0) {
                status = trace_info_query(comp_class, params, log_level,
                        result);
-       } else if (!strcmp(object, "support-info")) {
+       } else if (!strcmp(object, "babeltrace.support-info")) {
                status = support_info_query(comp_class, params, log_level, result);
        } else {
                BT_LOGE("Unknown query object `%s`", object);
index 8c212a3443126382c5b1ca521736f5403dc5967e..a4177240ed03b674fe32afd39dc893cd3b3a000a 100644 (file)
@@ -27,7 +27,7 @@ class TestSourceExt(Base, bt2._UserSourceComponent, message_iterator_class=TestI
 
     @staticmethod
     def _user_query(query_exec, obj, params, log_level):
-        if obj == 'support-info':
+        if obj == 'babeltrace.support-info':
             if params['type'] == 'file':
                 name = os.path.basename(str(params['input']))
 
@@ -65,7 +65,7 @@ class TestSourceSomeDir(
 
     @staticmethod
     def _user_query(query_exec, obj, params, log_level):
-        if obj == 'support-info':
+        if obj == 'babeltrace.support-info':
             if params['type'] == 'directory':
                 name = os.path.basename(str(params['input']))
                 return 1 if name == 'some-dir' else 0
@@ -84,7 +84,7 @@ class TestSourceABCDE(Base, bt2._UserSourceComponent, message_iterator_class=Tes
 
     @staticmethod
     def _user_query(query_exec, obj, params, log_level):
-        if obj == 'support-info':
+        if obj == 'babeltrace.support-info':
             return (
                 1.0
                 if params['type'] == 'string' and params['input'] == 'ABCDE'
index fc55205b1b95daf87c94851ac9ca41b475facd3c..8d8cda783a58e7762fb61e478b44550d6436b25c 100644 (file)
@@ -59,12 +59,14 @@ class QueryTraceInfoClockOffsetTestCase(unittest.TestCase):
         self.assertEqual(streams[1]['range-ns']['end'], 13515309000000120 + offset)
 
     # Test various cominations of the clock-class-offset-s and
-    # clock-class-offset-ns parameters to trace-info queries.
+    # clock-class-offset-ns parameters to babeltrace.trace-info queries.
 
     # Without clock class offset
 
     def test_no_clock_class_offset(self):
-        res = self._executor.query(self._fs, 'trace-info', {'inputs': self._inputs})
+        res = self._executor.query(
+            self._fs, 'babeltrace.trace-info', {'inputs': self._inputs}
+        )
         trace = res[0]
         self._check(trace, 0)
 
@@ -72,7 +74,9 @@ class QueryTraceInfoClockOffsetTestCase(unittest.TestCase):
 
     def test_clock_class_offset_s(self):
         res = self._executor.query(
-            self._fs, 'trace-info', {'inputs': self._inputs, 'clock-class-offset-s': 2}
+            self._fs,
+            'babeltrace.trace-info',
+            {'inputs': self._inputs, 'clock-class-offset-s': 2},
         )
         trace = res[0]
         self._check(trace, 2000000000)
@@ -81,7 +85,9 @@ class QueryTraceInfoClockOffsetTestCase(unittest.TestCase):
 
     def test_clock_class_offset_ns(self):
         res = self._executor.query(
-            self._fs, 'trace-info', {'inputs': self._inputs, 'clock-class-offset-ns': 2}
+            self._fs,
+            'babeltrace.trace-info',
+            {'inputs': self._inputs, 'clock-class-offset-ns': 2},
         )
         trace = res[0]
         self._check(trace, 2)
@@ -91,7 +97,7 @@ class QueryTraceInfoClockOffsetTestCase(unittest.TestCase):
     def test_clock_class_offset_both(self):
         res = self._executor.query(
             self._fs,
-            'trace-info',
+            'babeltrace.trace-info',
             {
                 'inputs': self._inputs,
                 'clock-class-offset-s': -2,
@@ -105,7 +111,7 @@ class QueryTraceInfoClockOffsetTestCase(unittest.TestCase):
         with self.assertRaises(bt2._Error):
             self._executor.query(
                 self._fs,
-                'trace-info',
+                'babeltrace.trace-info',
                 {'inputs': self._inputs, 'clock-class-offset-s': "2"},
             )
 
@@ -113,7 +119,7 @@ class QueryTraceInfoClockOffsetTestCase(unittest.TestCase):
         with self.assertRaises(bt2._Error):
             self._executor.query(
                 self._fs,
-                'trace-info',
+                'babeltrace.trace-info',
                 {'inputs': self._inputs, 'clock-class-offset-s': None},
             )
 
@@ -121,7 +127,7 @@ class QueryTraceInfoClockOffsetTestCase(unittest.TestCase):
         with self.assertRaises(bt2._Error):
             self._executor.query(
                 self._fs,
-                'trace-info',
+                'babeltrace.trace-info',
                 {'inputs': self._inputs, 'clock-class-offset-ns': "2"},
             )
 
@@ -129,7 +135,7 @@ class QueryTraceInfoClockOffsetTestCase(unittest.TestCase):
         with self.assertRaises(bt2._Error):
             self._executor.query(
                 self._fs,
-                'trace-info',
+                'babeltrace.trace-info',
                 {'inputs': self._inputs, 'clock-class-offset-ns': None},
             )
 
@@ -144,7 +150,7 @@ class QueryTraceInfoPortNameTestCase(unittest.TestCase):
     def test_trace_uuid_stream_class_id_no_stream_id(self):
         res = self._executor.query(
             self._fs,
-            "trace-info",
+            "babeltrace.trace-info",
             {
                 "inputs": [
                     os.path.join(
@@ -180,7 +186,7 @@ class QueryTraceInfoPortNameTestCase(unittest.TestCase):
     def test_trace_uuid_no_stream_class_id_no_stream_id(self):
         res = self._executor.query(
             self._fs,
-            "trace-info",
+            "babeltrace.trace-info",
             {"inputs": [os.path.join(test_ctf_traces_path, "succeed", "succeed1")]},
         )
 
@@ -210,13 +216,14 @@ class QueryTraceInfoRangeTestCase(unittest.TestCase):
         self._executor = bt2.QueryExecutor()
 
     def test_trace_no_range(self):
-        # This trace has no `timestamp_begin` and `timestamp_end` in its packet
-        # context. The `trace-info` query should omit the `range-ns` fields in
-        # the `trace` and `stream` data structures.
+        # This trace has no `timestamp_begin` and `timestamp_end` in its
+        # packet context. The `babeltrace.trace-info` query should omit
+        # the `range-ns` fields in the `trace` and `stream` data
+        # structures.
 
         res = self._executor.query(
             self._fs,
-            "trace-info",
+            "babeltrace.trace-info",
             {"inputs": [os.path.join(test_ctf_traces_path, "succeed", "succeed1")]},
         )
 
This page took 0.032997 seconds and 4 git commands to generate.