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

Refrain from overwriting the span status for unfinished spans #1577

Merged
merged 3 commits into from
Aug 22, 2023
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
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@

- Mark exceptions not handled by the user as `handled: false` ([#1535](https://github.com/getsentry/sentry-dart/pull/1535))
- This will affect your release health data, and is therefore considered a breaking change.

- Refrain from overwriting the span status for unfinished spans ([#1577](https://github.com/getsentry/sentry-dart/pull/1577))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 🚫 The changelog entry seems to be part of an already released section ## 8.0.0.
    Consider moving the entry to the ## Unreleased section, please.

- Older self-hosted sentry instances will drop transactions containing unfinished spans.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we link the min. version of the required self-hosted now.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change was part of relay PR relay/#1690, which was released with relay /22.12.0. I couldn't find the sentry server version from the change logs that is using this relay version.

- This change was introduced in [relay/#1690](https://github.com/getsentry/relay/pull/1690) and released with [22.12.0](https://github.com/getsentry/relay/releases/tag/22.12.0)

## 7.9.0

### Features
Expand Down
9 changes: 0 additions & 9 deletions dart/lib/src/sentry_tracer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,6 @@ class SentryTracer extends ISentrySpan {
_children.removeWhere(
(span) => !_hasSpanSuitableTimestamps(span, commonEndTimestamp));

// finish unfinished spans otherwise transaction gets dropped
final spansToBeFinished = _children.where((span) => !span.finished);
for (final span in spansToBeFinished) {
await span.finish(
status: SpanStatus.deadlineExceeded(),
endTimestamp: commonEndTimestamp,
);
}

var _rootEndTimestamp = commonEndTimestamp;
if (_trimEnd && children.isNotEmpty) {
final childEndTimestamps = children
Expand Down
22 changes: 3 additions & 19 deletions dart/test/sentry_tracer_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,24 +68,7 @@ void main() {
expect(sut.endTimestamp, endTimestamp);
});

test(
'tracer finish sets given end timestamp to all children while finishing them',
() async {
final sut = fixture.getSut();

final childA = sut.startChild('operation-a', description: 'description');
final childB = sut.startChild('operation-b', description: 'description');
final endTimestamp = getUtcDateTime();

await sut.finish(endTimestamp: endTimestamp);
await childA.finish();
await childB.finish();

expect(childA.endTimestamp, endTimestamp);
expect(childB.endTimestamp, endTimestamp);
});

test('tracer finishes unfinished spans', () async {
test('tracer does not finish unfinished spans', () async {
final sut = fixture.getSut();
sut.startChild('child');

Expand All @@ -94,7 +77,8 @@ void main() {
final tr = fixture.hub.captureTransactionCalls.first;
final child = tr.transaction.spans.first;

expect(child.status.toString(), 'deadline_exceeded');
expect(child.status, isNull);
expect(child.endTimestamp, isNull);
});

test('tracer sets data to extra', () async {
Expand Down
Loading