]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: trace: add the possibility to lock on some arguments
authorWilly Tarreau <w@1wt.eu>
Tue, 20 Aug 2019 17:22:53 +0000 (19:22 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 22 Aug 2019 18:21:00 +0000 (20:21 +0200)
Given that we can pass typed arguments to the trace() function, let's
add provisions for tracking them. They are source-specific so we need
to let the source fill their name and description. Only those with a
non-null name will be proposed.

include/types/trace.h

index aaf64cc26c972b1b03bae30c1cb6a47925c49a3d..6d85f9cbe4d1b7948e1eff3ba1e7f9b7c2c2c59a 100644 (file)
@@ -96,6 +96,10 @@ enum trace_lockon {
        TRACE_LOCKON_CONNECTION,  // lock on the connection that started the trace
        TRACE_LOCKON_SESSION,     // lock on the session that started the trace
        TRACE_LOCKON_STREAM,      // lock on the stream that started the trace
+       TRACE_LOCKON_ARG1,        // lock on arg1, totally source-dependent
+       TRACE_LOCKON_ARG2,        // lock on arg2, totally source-dependent
+       TRACE_LOCKON_ARG3,        // lock on arg3, totally source-dependent
+       TRACE_LOCKON_ARG4,        // lock on arg4, totally source-dependent
 };
 
 /* Each trace event maps a name to a mask in an uint64_t. Multiple bits are
@@ -110,6 +114,15 @@ struct trace_event {
        const char *desc;
 };
 
+/* add a name and description for each arg that we know we can track. Those
+ * with a non-null name will be presented in the menu and will be usable for
+ * trace lock-on.
+ */
+struct trace_lockon_arg {
+       const char *name;
+       const char *desc;
+};
+
 struct trace_source {
        /* source definition */
        const struct ist name;
@@ -117,6 +130,7 @@ struct trace_source {
        const struct trace_event *known_events;
        struct list source_link; // element in list of known trace sources
        uint32_t arg_def;        // argument definitions (sum of TRC_ARG{1..4}_*)
+       const struct trace_lockon_arg *lockon_args; // must be 4 entries if not NULL
        /* trace configuration, adjusted by "trace <module>" on CLI */
        enum trace_lockon lockon;
        uint64_t start_events;   // what will start the trace. default: 0=nothing