Skip to content

Commit

Permalink
Align method http span convention (#1477)
Browse files Browse the repository at this point in the history
Co-authored-by: Manoel Aranda Neto <[email protected]>
  • Loading branch information
stefanosiano and marandaneto authored May 24, 2023
1 parent 43760f9 commit 86d4841
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Fixes

- Align http method to span convention ([#1477](https://github.com/getsentry/sentry-dart/pull/1477))
- Wrapped methods return a `Future` instead of executing right away ([#1476](https://github.com/getsentry/sentry-dart/pull/1476))
- Relates to ([#1462](https://github.com/getsentry/sentry-dart/pull/1462))

Expand Down
2 changes: 1 addition & 1 deletion dart/lib/src/http_client/tracing_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class TracingClient extends BaseClient {
span = null;
}

span?.setData('method', request.method);
span?.setData('http.method', request.method);
urlDetails?.applyToSpan(span);

StreamedResponse? response;
Expand Down
2 changes: 1 addition & 1 deletion dart/lib/src/protocol/sentry_response.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import '../utils/iterable_extension.dart';
/// The response interface contains information on a HTTP request related to the event.
@immutable
class SentryResponse {
/// The tpye of this class in the [Contexts] field
/// The type of this class in the [Contexts] field
static const String type = 'response';

/// The size of the response body.
Expand Down
2 changes: 1 addition & 1 deletion dart/test/http_client/tracing_client_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void main() {
expect(span.status, SpanStatus.ok());
expect(span.context.operation, 'http.client');
expect(span.context.description, 'GET https://example.com');
expect(span.data['method'], 'GET');
expect(span.data['http.method'], 'GET');
expect(span.data['url'], 'https://example.com');
expect(span.data['http.query'], 'foo=bar');
expect(span.data['http.fragment'], 'baz');
Expand Down
4 changes: 2 additions & 2 deletions dio/lib/src/sentry_transformer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class SentryTransformer implements Transformer {
description: description,
);

span?.setData('method', options.method);
span?.setData('http.method', options.method);
urlDetails?.applyToSpan(span);

String? request;
Expand Down Expand Up @@ -62,7 +62,7 @@ class SentryTransformer implements Transformer {
description: description,
);

span?.setData('method', options.method);
span?.setData('http.method', options.method);
urlDetails?.applyToSpan(span);

dynamic transformedResponse;
Expand Down
2 changes: 1 addition & 1 deletion dio/lib/src/tracing_client_adapter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class TracingClientAdapter implements HttpClientAdapter {
span = null;
}

span?.setData('method', options.method);
span?.setData('http.method', options.method);
urlDetails?.applyToSpan(span);

ResponseBody? response;
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 @@ -39,7 +39,7 @@ void main() {
expect(span.status, SpanStatus.ok());
expect(span.context.operation, 'serialize.http.client');
expect(span.context.description, 'GET https://example.com');
expect(span.data['method'], 'GET');
expect(span.data['http.method'], 'GET');
expect(span.data['url'], 'https://example.com');
expect(span.data['http.query'], 'foo=bar');
expect(span.data['http.fragment'], 'baz');
Expand All @@ -65,7 +65,7 @@ void main() {
expect(span.status, SpanStatus.internalError());
expect(span.context.operation, 'serialize.http.client');
expect(span.context.description, 'GET https://example.com');
expect(span.data['method'], 'GET');
expect(span.data['http.method'], 'GET');
expect(span.data['url'], 'https://example.com');
expect(span.data['http.query'], 'foo=bar');
expect(span.data['http.fragment'], 'baz');
Expand Down Expand Up @@ -93,7 +93,7 @@ void main() {
expect(span.status, SpanStatus.ok());
expect(span.context.operation, 'serialize.http.client');
expect(span.context.description, 'GET https://example.com');
expect(span.data['method'], 'GET');
expect(span.data['http.method'], 'GET');
expect(span.data['url'], 'https://example.com');
expect(span.data['http.query'], 'foo=bar');
expect(span.data['http.fragment'], 'baz');
Expand Down Expand Up @@ -122,7 +122,7 @@ void main() {
expect(span.status, SpanStatus.internalError());
expect(span.context.operation, 'serialize.http.client');
expect(span.context.description, 'GET https://example.com');
expect(span.data['method'], 'GET');
expect(span.data['http.method'], 'GET');
expect(span.data['url'], 'https://example.com');
expect(span.data['http.query'], 'foo=bar');
expect(span.data['http.fragment'], 'baz');
Expand Down
2 changes: 1 addition & 1 deletion dio/test/tracing_client_adapter_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void main() {
expect(span.status, SpanStatus.ok());
expect(span.context.operation, 'http.client');
expect(span.context.description, 'GET https://example.com');
expect(span.data['method'], 'GET');
expect(span.data['http.method'], 'GET');
expect(span.data['url'], 'https://example.com');
expect(span.data['http.query'], 'foo=bar');
expect(span.data['http.fragment'], 'baz');
Expand Down

0 comments on commit 86d4841

Please sign in to comment.