From 54a641f6de869c2251c4597a59c022092deb6b4a Mon Sep 17 00:00:00 2001 From: Matthew Gumport Date: Mon, 21 Oct 2024 10:20:49 -0700 Subject: tag subrequests as such This adds a hook during the flow where we move the write permit around for subrequests to refresh stale assets to tag the parent span as being part of a subrequest. --- .bleep | 2 +- pingora-cache/src/lib.rs | 8 ++++++++ pingora-proxy/src/proxy_cache.rs | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.bleep b/.bleep index 334fc92..54ac764 100644 --- a/.bleep +++ b/.bleep @@ -1 +1 @@ -3dd34515725af2df875219491ab8542ecf59bd2b \ No newline at end of file +b6df57d294b9ccbe3a623b9ccd005e407cacc5a5 \ No newline at end of file diff --git a/pingora-cache/src/lib.rs b/pingora-cache/src/lib.rs index 1a97041..2aa2f7c 100644 --- a/pingora-cache/src/lib.rs +++ b/pingora-cache/src/lib.rs @@ -1142,6 +1142,14 @@ impl HttpCache { predictor.mark_uncacheable(self.cache_key(), reason); } } + + /// Tag all spans as being part of a subrequest. + pub fn tag_as_subrequest(&mut self) { + self.inner_mut() + .traces + .cache_span + .set_tag(|| Tag::new("is_subrequest", true)) + } } /// Set the header compression dictionary, which helps serialize http header. diff --git a/pingora-proxy/src/proxy_cache.rs b/pingora-proxy/src/proxy_cache.rs index e9914cf..865c592 100644 --- a/pingora-proxy/src/proxy_cache.rs +++ b/pingora-proxy/src/proxy_cache.rs @@ -153,6 +153,7 @@ impl HttpProxy { { // Put the write lock in the request session.cache.set_write_lock(write_lock); + session.cache.tag_as_subrequest(); // and then let it go to upstream break None; } -- cgit v1.2.3