Skip to content
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

Diagnostics: Adds Duration field to HttpResponseStatistics in Diagnostics #2558

Merged
merged 3 commits into from
Jun 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ public HttpResponseStatistics(
Exception exception)
{
this.RequestStartTime = requestStartTime;
this.RequestEndTime = requestEndTime;
this.Duration = requestEndTime - requestStartTime;
this.HttpResponseMessage = responseMessage;
this.Exception = exception;
this.ResourceType = resourceType;
Expand All @@ -399,7 +399,7 @@ public HttpResponseStatistics(
}

public DateTime RequestStartTime { get; }
public DateTime RequestEndTime { get; }
public TimeSpan Duration { get; }
public HttpResponseMessage HttpResponseMessage { get; }
public Exception Exception { get; }
public ResourceType ResourceType { get; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ private void VisitHttpResponseStatistics(ClientSideRequestStatisticsTraceDatum.H
jsonWriter.WriteFieldName("StartTimeUTC");
this.WriteDateTimeStringValue(stat.RequestStartTime);

jsonWriter.WriteFieldName("EndTimeUTC");
this.WriteDateTimeStringValue(stat.RequestEndTime);
jsonWriter.WriteFieldName("DurationInMs");
jsonWriter.WriteNumber64Value(stat.Duration.TotalMilliseconds);

jsonWriter.WriteFieldName("RequestUri");
jsonWriter.WriteStringValue(stat.RequestUri.ToString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ public void Visit(ClientSideRequestStatisticsTraceDatum clientSideRequestStatist
{
stringBuilder.AppendLine($"{space}HttpResponse");
stringBuilder.AppendLine($"{space}{space}RequestStartTime: {stat.RequestStartTime.ToString("o", CultureInfo.InvariantCulture)}");
stringBuilder.AppendLine($"{space}{space}RequestEndTime: {stat.RequestEndTime.ToString("o", CultureInfo.InvariantCulture)}");
stringBuilder.AppendLine($"{space}{space}DurationInMs: {stat.Duration.TotalMilliseconds:0.00}");
stringBuilder.AppendLine($"{space}{space}RequestUri: {stat.RequestUri}");
stringBuilder.AppendLine($"{space}{space}ResourceType: {stat.ResourceType}");
stringBuilder.AppendLine($"{space}{space}HttpMethod: {stat.HttpMethod}");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public async Task GatewayRequestStatsTest()
Assert.IsNotNull(datum.HttpResponseStatisticsList);
Assert.AreEqual(datum.HttpResponseStatisticsList.Count, 1);
Assert.IsNotNull(datum.HttpResponseStatisticsList[0].HttpResponseMessage);
Assert.AreEqual(datum.RequestEndTimeUtc, datum.HttpResponseStatisticsList[0].RequestEndTime);
Assert.AreEqual(datum.RequestEndTimeUtc, datum.HttpResponseStatisticsList[0].RequestStartTime + datum.HttpResponseStatisticsList[0].Duration);
}

[TestMethod]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -653,14 +653,14 @@
Http Response Statistics
HttpResponse
RequestStartTime: 0001-01-01T00:00:00.0000000
RequestEndTime: 9999-12-31T23:59:59.9999999
DurationInMs: 315537897600000.00
RequestUri: http://someuri1.com/
ResourceType: Document
HttpMethod: GET
StatusCode: OK
HttpResponse
RequestStartTime: 0001-01-01T00:00:00.0000000
RequestEndTime: 9999-12-31T23:59:59.9999999
DurationInMs: 315537897600000.00
RequestUri: http://someuri1.com/
ResourceType: Document
HttpMethod: GET
Expand Down Expand Up @@ -689,7 +689,7 @@
"HttpResponseStats": [
{
"StartTimeUTC": "0001-01-01T00:00:00",
"EndTimeUTC": "9999-12-31T23:59:59.9999999",
"DurationInMs": 315537897600000,
"RequestUri": "http://someuri1.com/",
"ResourceType": "Document",
"HttpMethod": "GET",
Expand All @@ -698,7 +698,7 @@
},
{
"StartTimeUTC": "0001-01-01T00:00:00",
"EndTimeUTC": "9999-12-31T23:59:59.9999999",
"DurationInMs": 315537897600000,
"RequestUri": "http://someuri1.com/",
"ResourceType": "Document",
"HttpMethod": "GET",
Expand Down