git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] fetch-pack: write effective filter to trace2

From
JTJonathan Tan <jonathantanmy@google.com>
Date
Jul 15, 2022, 17:29 UTC
Message-ID
<20220715172943.2681492-1-jonathantanmy@google.com>

Administrators of a managed Git environment (like the one at $DAYJOB) might want to quantify the performance change of fetches with and without partial clone from the client's point of view. Therefore, log the effective filter being sent to the server whenever a fetch (or clone) occurs. Note that this is not necessarily the same as what's specified on the CLI, because during a fetch, the configured filter is used whenever a filter is not specified on the CLI.

This is implemented for protocol v0, v1, and v2.
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
---
 fetch-pack.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/fetch-pack.c b/fetch-pack.c
index cb6647d657..dec8743bec 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -392,7 +392,10 @@ static int find_common(struct fetch_negotiator *negotiator,
 	if (server_supports_filtering && args->filter_options.choice) {
 		const char *spec =
 			expand_list_objects_filter_spec(&args->filter_options);
+		trace2_data_string("fetch", the_repository, "fetch/effective-filter", spec);
 		packet_buf_write(&req_buf, "filter %s", spec);
+	} else {
+		trace2_data_string("fetch", the_repository, "fetch/effective-filter", "none");
 	}
 	packet_buf_flush(&req_buf);
 	state_len = req_buf.len;
@@ -1328,9 +1331,12 @@ static int send_fetch_request(struct fetch_negotiator *negotiator, int fd_out,
 		const char *spec =
 			expand_list_objects_filter_spec(&args->filter_options);
 		print_verbose(args, _("Server supports filter"));
+		trace2_data_string("fetch", the_repository, "fetch/effective-filter", spec);
 		packet_buf_write(&req_buf, "filter %s", spec);
-	} else if (args->filter_options.choice) {
-		warning("filtering not recognized by server, ignoring");
+	} else {
+		if (args->filter_options.choice)
+			warning("filtering not recognized by server, ignoring");
+		trace2_data_string("fetch", the_repository, "fetch/effective-filter", "none");
 	}
 
 	if (server_supports_feature("fetch", "packfile-uris", 0)) {
-- 
2.37.0.170.g444d1eabd0-goog
Next: Jeff Hostetler
Message 1 of 15 in “fetch-pack: write effective filter to trace2”
  1. fetch-pack: write effective filter to trace2Jonathan Tan, Jul 15, 2022
  2. Jeff HostetlerJul 15, 2022
  3. Junio C HamanoJul 15, 2022
  4. Jonathan TanJul 15, 2022
  5. Junio C HamanoJul 15, 2022
  6. Jonathan TanJul 15, 2022
  7. Jeff HostetlerJul 18, 2022
  8. Junio C HamanoJul 18, 2022
  9. Jonathan TanJul 18, 2022
  10. Junio C HamanoJul 18, 2022
  11. fetch-pack: write effective filter to trace2Jonathan Tan, Jul 18, 2022
  12. Junio C HamanoJul 18, 2022
  13. Junio C HamanoJul 25, 2022
  14. Jonathan TanJul 26, 2022
  15. fetch-pack: write effective filter to trace2Jonathan Tan, Jul 26, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.