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

Include unfinished spans in transactions #3013

Merged
merged 4 commits into from
Jan 8, 2024
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## Unreleased

### Significant change in behavior

- Transactions spans are no longer automatically finished with the transaction. This is now handled by the relay.
- Customers self hosting Sentry must use verion 22.12.0 or later ([#3013](https://github.com/getsentry/sentry-dotnet/pull/3013))

### Dependencies

- Bump CLI from v2.23.2 to v2.24.1 ([#3012](https://github.com/getsentry/sentry-dotnet/pull/3012))
Expand Down
9 changes: 0 additions & 9 deletions src/Sentry/TransactionTracer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -370,15 +370,6 @@ public void Finish()
EndTimestamp ??= _stopwatch.CurrentDateTimeOffset;
_options?.LogDebug("Finished Transaction {0}.", SpanId);

foreach (var span in _spans)
{
if (!span.IsFinished)
{
_options?.LogDebug("Deadline exceeded for Transaction {0} -> Span {1}.", SpanId, span.SpanId);
span.Finish(SpanStatus.DeadlineExceeded);
}
}

// Clear the transaction from the scope
_hub.ConfigureScope(scope => scope.ResetTransaction(this));

Expand Down
23 changes: 0 additions & 23 deletions test/Sentry.Tests/Protocol/TransactionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -380,29 +380,6 @@ public void Finish_RecordsTime()
(transaction.EndTimestamp - transaction.StartTimestamp).Should().BeGreaterOrEqualTo(TimeSpan.Zero);
}

[Fact]
public void Finish_UnfinishedSpansGetsFinishedWithDeadlineStatus()
{
// Arrange
var transaction = new TransactionTracer(DisabledHub.Instance, "my name", "my op");
transaction.StartChild("children1");
transaction.StartChild("children2");
transaction.StartChild("children3.finished").Finish(SpanStatus.Ok);
transaction.StartChild("children4");

// Act
transaction.Finish();

// Assert

Assert.All(transaction.Spans.Where(span => !span.Operation.EndsWith("finished")), span =>
{
Assert.True(span.IsFinished);
Assert.Equal(SpanStatus.DeadlineExceeded, span.Status);
});
Assert.Single(transaction.Spans.Where(span => span.Operation.EndsWith("finished") && span.Status == SpanStatus.Ok));
}

[Fact]
public void Finish_SentryRequestSpansGetIgnored()
{
Expand Down