Skip to content

Commit 855ad32

Browse files
Liubov Dmitrievafacebook-github-bot
authored andcommitted
traffic attribution: log new fields to scuba
Summary: log new fields to scuba Reviewed By: RajivTS Differential Revision: D72171233 fbshipit-source-id: 497610f6a14ec40bc5b2c2b355442ed985bb102a
1 parent 1750f4a commit 855ad32

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

eden/mononoke/lfs_server/src/scuba.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,11 @@ pub enum LfsScubaKey {
6161
SandcastleNonce,
6262
SandcastleAlias,
6363
SandcastleType,
64+
SandcastleVCS,
6465
ClientTwJob,
6566
ClientTwTask,
67+
/// Fetch cause
68+
FetchCause,
6669
}
6770

6871
impl AsRef<str> for LfsScubaKey {
@@ -89,8 +92,10 @@ impl AsRef<str> for LfsScubaKey {
8992
SandcastleNonce => "sandcastle_nonce",
9093
SandcastleAlias => "sandcastle_alias",
9194
SandcastleType => "sandcastle_type",
95+
SandcastleVCS => "sandcastle_vcs",
9296
ClientTwJob => "client_tw_job",
9397
ClientTwTask => "client_tw_task",
98+
FetchCause => "fetch_cause",
9499
}
95100
}
96101
}
@@ -108,6 +113,7 @@ pub struct LfsScubaHandler {
108113
client_attempts_left: Option<u64>,
109114
client_throttle_attempts_left: Option<u64>,
110115
client_info: Option<ClientInfo>,
116+
fetch_cause: Option<String>,
111117
}
112118

113119
impl ScubaHandler for LfsScubaHandler {
@@ -123,12 +129,15 @@ impl ScubaHandler for LfsScubaHandler {
123129
read_header_value_ignore_err(state, CLIENT_INFO_HEADER)
124130
.map(|ci: ClientInfoHeader| ci.0);
125131

132+
let fetch_cause = read_header_value_ignore_err(state, "X-Fetch-Cause");
133+
126134
Self {
127135
ctx: state.try_borrow::<RequestContext>().cloned(),
128136
client_attempt,
129137
client_attempts_left,
130138
client_throttle_attempts_left,
131139
client_info,
140+
fetch_cause,
132141
}
133142
}
134143

@@ -174,11 +183,15 @@ impl ScubaHandler for LfsScubaHandler {
174183
client_info.fb.sandcastle_type(),
175184
);
176185

186+
scuba.add_opt(LfsScubaKey::SandcastleVCS, client_info.fb.sandcastle_vcs());
187+
177188
scuba.add_opt(LfsScubaKey::ClientTwJob, client_info.fb.tw_job());
178189

179190
scuba.add_opt(LfsScubaKey::ClientTwTask, client_info.fb.tw_task());
180191
}
181192

193+
scuba.add_opt(LfsScubaKey::FetchCause, self.fetch_cause);
194+
182195
scuba.log();
183196
}
184197
}

0 commit comments

Comments
 (0)