Skip to content
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Unreleased

### Fixes

- Align span spec for serialize ops ([#1024](https://github.com/getsentry/sentry-dart/pull/1024))

## 6.11.0

### Fixes
Expand Down
6 changes: 4 additions & 2 deletions dio/lib/src/sentry_transformer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import 'package:sentry/sentry.dart';

/// A transformer which wraps transforming in spans
class SentryTransformer implements Transformer {
static const _serializeOp = 'serialize.http.client';

// ignore: public_member_api_docs
SentryTransformer({required Transformer transformer, Hub? hub})
: _hub = hub ?? HubAdapter(),
Expand All @@ -14,7 +16,7 @@ class SentryTransformer implements Transformer {
@override
Future<String> transformRequest(RequestOptions options) async {
final span = _hub.getSpan()?.startChild(
'serialize',
_serializeOp,
description: '${options.method} ${options.uri}',
);
String? request;
Expand All @@ -38,7 +40,7 @@ class SentryTransformer implements Transformer {
ResponseBody response,
) async {
final span = _hub.getSpan()?.startChild(
'serialize',
_serializeOp,
description: '${options.method} ${options.uri}',
);
dynamic transformedResponse;
Expand Down
8 changes: 4 additions & 4 deletions dio/test/sentry_transformer_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void main() {
final span = tracer.children.first;

expect(span.status, SpanStatus.ok());
expect(span.context.operation, 'serialize');
expect(span.context.operation, 'serialize.http.client');
expect(span.context.description, 'GET foo');
});

Expand All @@ -56,7 +56,7 @@ void main() {
final span = tracer.children.first;

expect(span.status, SpanStatus.internalError());
expect(span.context.operation, 'serialize');
expect(span.context.operation, 'serialize.http.client');
expect(span.context.description, 'GET foo');
expect(span.finished, true);
});
Expand All @@ -80,7 +80,7 @@ void main() {
final span = tracer.children.first;

expect(span.status, SpanStatus.ok());
expect(span.context.operation, 'serialize');
expect(span.context.operation, 'serialize.http.client');
expect(span.context.description, 'GET foo');
});
test('transformResponse finish span if errored request', () async {
Expand All @@ -104,7 +104,7 @@ void main() {
final span = tracer.children.first;

expect(span.status, SpanStatus.internalError());
expect(span.context.operation, 'serialize');
expect(span.context.operation, 'serialize.http.client');
expect(span.context.description, 'GET foo');
expect(span.finished, true);
});
Expand Down
2 changes: 1 addition & 1 deletion flutter/lib/src/sentry_asset_bundle.dart
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ class SentryAssetBundle implements AssetBundle {
ISentrySpan? outerSpan,
) async {
final span = outerSpan?.startChild(
'serialize',
'serialize.file.read',
description: 'parsing "$key" to "$T"',
);
T data;
Expand Down
4 changes: 2 additions & 2 deletions flutter/test/sentry_asset_bundle_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ void main() {
expect(span.status, SpanStatus.internalError());
expect(span.finished, true);
expect(span.throwable, isA<Exception>());
expect(span.context.operation, 'serialize');
expect(span.context.operation, 'serialize.file.read');
expect(
span.context.description,
'parsing "resources/test.txt" to "String"',
Expand Down Expand Up @@ -325,7 +325,7 @@ void main() {

expect(span.status, SpanStatus.ok());
expect(span.finished, true);
expect(span.context.operation, 'serialize');
expect(span.context.operation, 'serialize.file.read');
expect(
span.context.description,
'parsing "resources/test.txt" to "String"',
Expand Down