-
Notifications
You must be signed in to change notification settings - Fork 140
trace2: move generation of 'def_param' events into code for 'cmd_name' #1679
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
trace2: move generation of 'def_param' events into code for 'cmd_name' #1679
Conversation
8967b38
to
7612b3e
Compare
There are issues in commit fcf1027: |
7612b3e
to
aae7007
Compare
@jeffhostetler I opened jeffhostetler#13 to address all those CI failures: Subject: fixup! t0211: demonstrate missing 'def_param' events for certain commands
diff --git a/t/t0211-trace2-perf.sh b/t/t0211-trace2-perf.sh
index 30c7a55233a..fe23b8b9d48 100755
--- a/t/t0211-trace2-perf.sh
+++ b/t/t0211-trace2-perf.sh
@@ -344,10 +344,10 @@ test_expect_success 'expect def_params for remote-curl and _run_dashed_' '
test_config_global "cfg.prop.foo" "red" &&
- ENV_PROP_FOO=blue \
+ test_might_fail env \
+ ENV_PROP_FOO=blue \
GIT_TRACE2_PERF="$(pwd)/prop.perf" \
- test_might_fail \
- git remote-http x y &&
+ git remote-http x y &&
perl "$TEST_DIRECTORY/t0211/scrub_perf.perl" <prop.perf >actual &&
@@ -368,10 +368,10 @@ test_expect_success 'expect def_params for http-fetch and _run_dashed_' '
test_config_global "cfg.prop.foo" "red" &&
- ENV_PROP_FOO=blue \
+ test_might_fail env \
+ ENV_PROP_FOO=blue \
GIT_TRACE2_PERF="$(pwd)/prop.perf" \
- test_might_fail \
- git http-fetch --stdin file:/// <<-EOF &&
+ git http-fetch --stdin file:/// <<-EOF &&
EOF
perl "$TEST_DIRECTORY/t0211/scrub_perf.perl" <prop.perf >actual && |
There are issues in commit 70cb3a7: |
Some Git commands fail to emit 'def_param' events for interesting config and environment variable settings. Add unit tests to demonstrate this. Most commands are considered "builtin" and are based upon git.c. These typically do emit 'def_param' events. Exceptions are some of the "query" commands, the "run-dashed" mechanism, and alias handling. Commands built from remote-curl.c (instead of git.c), such as "git-remote-https", do not emit 'def_param' events. Likewise, "git-http-fetch" is built http-fetch.c and does not emit them. Signed-off-by: Jeff Hostetler <[email protected]>
During nested alias expansion it is possible for "trace2_cmd_list_config()" and "trace2_cmd_list_env_vars()" to be called more than once. This causes a full set of 'def_param' events to be emitted each time. Let's avoid that. Add code to those two functions to only emit them once. Signed-off-by: Jeff Hostetler <[email protected]>
70cb3a7
to
e852871
Compare
/submit |
Submitted as [email protected] To fetch this version into
To fetch this version to local tag
|
This branch is now known as |
This patch series was integrated into seen via git@f991be6. |
There was a status update in the "New Topics" section about the branch Some trace2 events that lacked def_param have learned to show it, enriching the output. Needs review. source: <[email protected]> |
This patch series was integrated into seen via git@9f9a9f0. |
@@ -373,8 +373,6 @@ static int handle_alias(int *argcp, const char ***argv) | |||
strvec_pushv(&child.args, (*argv) + 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the Git mailing list, Josh Steadmon wrote (reply to this):
On 2024.03.04 15:40, Jeff Hostetler via GitGitGadget wrote:
> From: Jeff Hostetler <[email protected]>
>
> Now that "trace2_cmd_name()" implicitly calls "trace2_cmd_list_config()"
> and "trace2_cmd_list_env_vars()", we don't need to explicitly call them.
>
> Signed-off-by: Jeff Hostetler <[email protected]>
> ---
> git.c | 6 ------
> 1 file changed, 6 deletions(-)
>
> diff --git a/git.c b/git.c
> index 7068a184b0a..a769d72ab8f 100644
> --- a/git.c
> +++ b/git.c
> @@ -373,8 +373,6 @@ static int handle_alias(int *argcp, const char ***argv)
> strvec_pushv(&child.args, (*argv) + 1);
>
> trace2_cmd_alias(alias_command, child.args.v);
> - trace2_cmd_list_config();
> - trace2_cmd_list_env_vars();
> trace2_cmd_name("_run_shell_alias_");
>
> ret = run_command(&child);
> @@ -411,8 +409,6 @@ static int handle_alias(int *argcp, const char ***argv)
> COPY_ARRAY(new_argv + count, *argv + 1, *argcp);
>
> trace2_cmd_alias(alias_command, new_argv);
> - trace2_cmd_list_config();
> - trace2_cmd_list_env_vars();
>
> *argv = new_argv;
> *argcp += count - 1;
> @@ -462,8 +458,6 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
>
> trace_argv_printf(argv, "trace: built-in: git");
> trace2_cmd_name(p->cmd);
> - trace2_cmd_list_config();
> - trace2_cmd_list_env_vars();
>
> validate_cache_entries(the_repository->index);
> status = p->fn(argc, argv, prefix);
> --
> gitgitgadget
>
I'd personally prefer to see this squashed into Patch 3, but I don't
feel too strongly about it. Either way, the series LGTM.
Reviewed-by: Josh Steadmon <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the Git mailing list, Junio C Hamano wrote (reply to this):
Josh Steadmon <[email protected]> writes:
> On 2024.03.04 15:40, Jeff Hostetler via GitGitGadget wrote:
>> From: Jeff Hostetler <[email protected]>
>>
>> Now that "trace2_cmd_name()" implicitly calls "trace2_cmd_list_config()"
>> and "trace2_cmd_list_env_vars()", we don't need to explicitly call them.
>>
>> Signed-off-by: Jeff Hostetler <[email protected]>
>> ---
>> git.c | 6 ------
>> 1 file changed, 6 deletions(-)
>>
>> diff --git a/git.c b/git.c
>> index 7068a184b0a..a769d72ab8f 100644
>> --- a/git.c
>> +++ b/git.c
>> @@ -373,8 +373,6 @@ static int handle_alias(int *argcp, const char ***argv)
>> strvec_pushv(&child.args, (*argv) + 1);
>>
>> trace2_cmd_alias(alias_command, child.args.v);
>> - trace2_cmd_list_config();
>> - trace2_cmd_list_env_vars();
>> trace2_cmd_name("_run_shell_alias_");
>>
>> ret = run_command(&child);
>> @@ -411,8 +409,6 @@ static int handle_alias(int *argcp, const char ***argv)
>> COPY_ARRAY(new_argv + count, *argv + 1, *argcp);
>>
>> trace2_cmd_alias(alias_command, new_argv);
>> - trace2_cmd_list_config();
>> - trace2_cmd_list_env_vars();
>>
>> *argv = new_argv;
>> *argcp += count - 1;
>> @@ -462,8 +458,6 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
>>
>> trace_argv_printf(argv, "trace: built-in: git");
>> trace2_cmd_name(p->cmd);
>> - trace2_cmd_list_config();
>> - trace2_cmd_list_env_vars();
>>
>> validate_cache_entries(the_repository->index);
>> status = p->fn(argc, argv, prefix);
>> --
>> gitgitgadget
>>
>
> I'd personally prefer to see this squashed into Patch 3, but I don't
> feel too strongly about it. Either way, the series LGTM.
>
> Reviewed-by: Josh Steadmon <[email protected]>
Let's see what JeffH says about this. I agree with you that making
some stuff redundant in [Patch 3/4] and fixing the redundancy in
this step does feel somewhat roundabout way of doing this.
Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the Git mailing list, Jeff Hostetler wrote (reply to this):
On 3/6/24 4:57 PM, Junio C Hamano wrote:
> Josh Steadmon <[email protected]> writes:
> >> On 2024.03.04 15:40, Jeff Hostetler via GitGitGadget wrote:
>>> From: Jeff Hostetler <[email protected]>
>>>
>>> Now that "trace2_cmd_name()" implicitly calls "trace2_cmd_list_config()"
>>> and "trace2_cmd_list_env_vars()", we don't need to explicitly call them.
>>>
>>> Signed-off-by: Jeff Hostetler <[email protected]>
>>> ---
>>> git.c | 6 ------
>>> 1 file changed, 6 deletions(-)
>>>
>>> diff --git a/git.c b/git.c
>>> index 7068a184b0a..a769d72ab8f 100644
>>> --- a/git.c
>>> +++ b/git.c
>>> @@ -373,8 +373,6 @@ static int handle_alias(int *argcp, const char ***argv)
>>> strvec_pushv(&child.args, (*argv) + 1);
>>> >>> trace2_cmd_alias(alias_command, child.args.v);
>>> - trace2_cmd_list_config();
>>> - trace2_cmd_list_env_vars();
>>> trace2_cmd_name("_run_shell_alias_");
>>> >>> ret = run_command(&child);
>>> @@ -411,8 +409,6 @@ static int handle_alias(int *argcp, const char ***argv)
>>> COPY_ARRAY(new_argv + count, *argv + 1, *argcp);
>>> >>> trace2_cmd_alias(alias_command, new_argv);
>>> - trace2_cmd_list_config();
>>> - trace2_cmd_list_env_vars();
>>> >>> *argv = new_argv;
>>> *argcp += count - 1;
>>> @@ -462,8 +458,6 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
>>> >>> trace_argv_printf(argv, "trace: built-in: git");
>>> trace2_cmd_name(p->cmd);
>>> - trace2_cmd_list_config();
>>> - trace2_cmd_list_env_vars();
>>> >>> validate_cache_entries(the_repository->index);
>>> status = p->fn(argc, argv, prefix);
>>> -- >>> gitgitgadget
>>>
>>
>> I'd personally prefer to see this squashed into Patch 3, but I don't
>> feel too strongly about it. Either way, the series LGTM.
>>
>> Reviewed-by: Josh Steadmon <[email protected]>
> > Let's see what JeffH says about this. I agree with you that making
> some stuff redundant in [Patch 3/4] and fixing the redundancy in
> this step does feel somewhat roundabout way of doing this.
> > Thanks.
> Sure we can merge them. That's fine. I can send a V4 or if you want
to just squash them together that's fine.
Jeff
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the Git mailing list, Junio C Hamano wrote (reply to this):
Jeff Hostetler <[email protected]> writes:
>>> Reviewed-by: Josh Steadmon <[email protected]>
>> Let's see what JeffH says about this. I agree with you that making
>> some stuff redundant in [Patch 3/4] and fixing the redundancy in
>> this step does feel somewhat roundabout way of doing this.
>> Thanks.
>>
>
> Sure we can merge them. That's fine. I can send a V4 or if you want
> to just squash them together that's fine.
Let's have a v4 describing the change for combined 3&4 in your
words, with Josh's Reviewed-by: already added to the trailers.
Thanks, both of you.
User |
This patch series was integrated into seen via git@4082b9e. |
User |
This patch series was integrated into seen via git@6b2e4ea. |
This patch series was integrated into seen via git@b110890. |
Some commands do not cause a set of 'def_param' events to be emitted. This includes "git-remote-https", "git-http-fetch", and various "query" commands, like "git --man-path". Since all of these commands do emit a 'cmd_name' event, add code to the "trace2_cmd_name()" function to generate the set of 'def_param' events. Remove explicit calls to "trace2_cmd_list_config()" and "trace2_cmd_list_env_vars()" in git.c since they are no longer needed. Reviewed-by: Josh Steadmon <[email protected]> Signed-off-by: Jeff Hostetler <[email protected]>
e852871
to
178721c
Compare
/submit |
Submitted as [email protected] To fetch this version into
To fetch this version to local tag
|
This patch series was integrated into seen via git@dde6457. |
There was a status update in the "Cooking" section about the branch Some trace2 events that lacked def_param have learned to show it, enriching the output. Reviewed-by: Josh Steadmon <[email protected]> cf. <[email protected]> Will merge to 'next'. source: <[email protected]> |
This patch series was integrated into seen via git@a70c6fa. |
This patch series was integrated into next via git@a797cfe. |
This patch series was integrated into seen via git@88a6252. |
This patch series was integrated into seen via git@75b82b4. |
There was a status update in the "Cooking" section about the branch Some trace2 events that lacked def_param have learned to show it, enriching the output. Reviewed-by: Josh Steadmon <[email protected]> cf. <[email protected]> Will merge to 'master'. source: <[email protected]> |
This patch series was integrated into seen via git@9084feb. |
This patch series was integrated into seen via git@5803d1d. |
This patch series was integrated into seen via git@819e86c. |
There was a status update in the "Cooking" section about the branch Some trace2 events that lacked def_param have learned to show it, enriching the output. Reviewed-by: Josh Steadmon <[email protected]> cf. <[email protected]> Will merge to 'master'. source: <[email protected]> |
This patch series was integrated into seen via git@cc31cc5. |
This patch series was integrated into seen via git@7f1e926. |
This patch series was integrated into master via git@7f1e926. |
This patch series was integrated into next via git@7f1e926. |
Closed via 7f1e926. |
Here is version 2 of this series. The only change from V1 is to combine the last
two commits as discussed.
Thanks
Jeff
Some Git commands do not emit
def_param
events for interesting config andenvironment variable settings. Let's fix that.
Builtin commands compiled into
git.c
have the normal control flow and emita
cmd_name
event and thendef_param
events for each interesting config andenvironment variable. However, some special "query" commands, like
--exec-path
,or some forms of alias expansion, emitted a
cmd_name
but did not emitdef_param
events.
Also, special commands
git-remote-https
is built fromremote-curl.c
andgit-http-fetch
is built fromhttp-fetch.c
and do not use the normal set up ingit.c
.These emitted a
cmd_name
but notdef_param
events.To minimize the footprint of this commit, move the calls to
trace2_cmd_list_config()
and
trace2_cmd_list_env_vars()
intotrace2_cmd_name()
so that we always get aset of
def_param
events when acmd_name
event is generated.Users can define local config settings on a repo to classify/name a repo (e.g. "project-foo"
vs "personal") and use the
def_param
feature to label Trace2 data so that (a third-party)telemetry service does not collect data on personal repos or so that telemetry from one
work repo is distinguishable from another work repo in database queries.
cc: Josh Steadmon [email protected]
cc: Jeff Hostetler [email protected]