Skip to content
This repository has been archived by the owner on Jul 5, 2020. It is now read-only.

Do not stop Activity in Stop events, set end time instead #1039

Merged
merged 3 commits into from
Oct 12, 2018
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Version 2.9.0-beta1
- [Prevent duplicate dependency collection in multi-host apps](https://github.com/Microsoft/ApplicationInsights-aspnetcore/issues/621)
- [Fix missing transactions Sql dependencies](https://github.com/Microsoft/ApplicationInsights-dotnet-server/pull/1031)
- [Fix: Do not stop Activity in the Stop events, set end time instead](https://github.com/Microsoft/ApplicationInsights-dotnet-server/issues/1038)

## Version 2.8.0-beta2
- [LiveMetrics (QuickPulse) TelemetryProcessor added automatically to the default ApplicationInsights.config are moved under the default telemetry sink.](https://github.com/Microsoft/ApplicationInsights-dotnet-server/pull/987)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,10 +379,11 @@ internal void OnActivityStop(HttpResponseMessage response, HttpRequestMessage re

this.client.Initialize(telemetry);

// If we started auxiliary Activity before to override the Id with W3C compatible one, now it's time to stop it
// If we started auxiliary Activity before to override the Id with W3C compatible one,
// now it's time to set end time on it
if (currentActivity.Duration == TimeSpan.Zero)
{
currentActivity.Stop();
currentActivity.SetEndTime(DateTime.UtcNow);
}

telemetry.Timestamp = currentActivity.StartTimeUtc;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,11 @@ public override void OnEvent(KeyValuePair<string, object> evnt, DiagnosticListen
break;
case "Microsoft.Azure.EventHubs.Send.Stop":
case "Microsoft.Azure.EventHubs.Receive.Stop":
// If we started auxiliary Activity before to override the Id with W3C compatible one, now it's time to stop it
// If we started auxiliary Activity before to override the Id with W3C compatible one,
// now it's time to set end time on it
if (currentActivity.Duration == TimeSpan.Zero)
{
currentActivity.Stop();
currentActivity.SetEndTime(DateTime.UtcNow);
}

this.OnDependency(evnt.Key, evnt.Value, currentActivity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ public override void OnEvent(KeyValuePair<string, object> evnt, DiagnosticListen
{
case "Microsoft.Azure.ServiceBus.ProcessSession.Stop":
case "Microsoft.Azure.ServiceBus.Process.Stop":
// If we started auxiliary Activity before to override the Id with W3C compatible one, now it's time to stop it
// If we started auxiliary Activity before to override the Id with W3C compatible one,
// now it's time to set end time on it
if (currentActivity.Duration == TimeSpan.Zero)
{
currentActivity.Stop();
currentActivity.SetEndTime(DateTime.UtcNow);
}

this.OnRequest(evnt.Key, evnt.Value, currentActivity);
Expand All @@ -61,10 +62,11 @@ public override void OnEvent(KeyValuePair<string, object> evnt, DiagnosticListen
}
else if (evnt.Key.EndsWith(TelemetryDiagnosticSourceListener.ActivityStopNameSuffix, StringComparison.Ordinal))
{
// If we started auxiliary Activity before to override the Id with W3C compatible one, now it's time to stop it
// If we started auxiliary Activity before to override the Id with W3C compatible one,
// now it's time to set end time on it
if (currentActivity.Duration == TimeSpan.Zero)
{
currentActivity.Stop();
currentActivity.SetEndTime(DateTime.UtcNow);
}

this.OnDependency(evnt.Key, evnt.Value, currentActivity);
Expand Down