Skip to content

Commit 71ad454

Browse files
feature: conditional check to not overwrite ClientRequestId if already set
1 parent 1d465ea commit 71ad454

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/Accounts/Accounts/CommonModule/AzModule.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,13 +181,17 @@ internal async Task OnResponseCreated(string id, CancellationToken cancellationT
181181
AzurePSQoSEvent qos;
182182
if (_telemetry.TryGetValue(processRecordId, out qos) && null != response?.Headers)
183183
{
184-
IEnumerable<string> headerValues;
185-
foreach (var headerName in ClientHeaders)
184+
// Only set ClientRequestId if it hasn't been set already by OnBeforeCall from request headers
185+
if (string.IsNullOrEmpty(qos.ClientRequestId))
186186
{
187-
if (response.Headers.TryGetValues(headerName, out headerValues) && headerValues.Any())
187+
IEnumerable<string> headerValues;
188+
foreach (var headerName in ClientHeaders)
188189
{
189-
qos.ClientRequestId = headerValues.First();
190-
break;
190+
if (response.Headers.TryGetValues(headerName, out headerValues) && headerValues.Any())
191+
{
192+
qos.ClientRequestId = headerValues.First();
193+
break;
194+
}
191195
}
192196
}
193197
}

0 commit comments

Comments
 (0)