diff --git a/CHANGELOG.md b/CHANGELOG.md index bbf9d038dc..6d77ff550c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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)) diff --git a/dart/lib/src/http_client/tracing_client.dart b/dart/lib/src/http_client/tracing_client.dart index 1b117f9eda..3055fc6e39 100644 --- a/dart/lib/src/http_client/tracing_client.dart +++ b/dart/lib/src/http_client/tracing_client.dart @@ -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; diff --git a/dart/lib/src/protocol/sentry_response.dart b/dart/lib/src/protocol/sentry_response.dart index ff34a2a8c0..f4438a3b0e 100644 --- a/dart/lib/src/protocol/sentry_response.dart +++ b/dart/lib/src/protocol/sentry_response.dart @@ -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. diff --git a/dart/test/http_client/tracing_client_test.dart b/dart/test/http_client/tracing_client_test.dart index 0b175174cf..a535eb50d6 100644 --- a/dart/test/http_client/tracing_client_test.dart +++ b/dart/test/http_client/tracing_client_test.dart @@ -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'); diff --git a/dio/lib/src/sentry_transformer.dart b/dio/lib/src/sentry_transformer.dart index eaf6c49d00..cdc7aa5342 100644 --- a/dio/lib/src/sentry_transformer.dart +++ b/dio/lib/src/sentry_transformer.dart @@ -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; @@ -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; diff --git a/dio/lib/src/tracing_client_adapter.dart b/dio/lib/src/tracing_client_adapter.dart index 38f743f0f7..91a243e2c7 100644 --- a/dio/lib/src/tracing_client_adapter.dart +++ b/dio/lib/src/tracing_client_adapter.dart @@ -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; diff --git a/dio/test/sentry_transformer_test.dart b/dio/test/sentry_transformer_test.dart index 821b9a6beb..125acba558 100644 --- a/dio/test/sentry_transformer_test.dart +++ b/dio/test/sentry_transformer_test.dart @@ -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'); @@ -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'); @@ -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'); @@ -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'); diff --git a/dio/test/tracing_client_adapter_test.dart b/dio/test/tracing_client_adapter_test.dart index 0e28e6c892..0d4a0c3d14 100644 --- a/dio/test/tracing_client_adapter_test.dart +++ b/dio/test/tracing_client_adapter_test.dart @@ -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');