Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
add http.request.method to http spans
  • Loading branch information
buenaflor committed Sep 8, 2023
commit 4eb10d3d9332cbf5fef7e9cfec4cbbda56707a90
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 @@ -41,7 +41,7 @@ class TracingClient extends BaseClient {
span = null;
}

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

StreamedResponse? response;
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['http.method'], 'GET');
expect(span.data['http.request.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('http.method', options.method);
span?.setData('http.request.method', options.method);
// ignore: invalid_use_of_internal_member
span?.origin = SentryTraceOrigins.autoHttpDioTransformer;

Expand Down Expand Up @@ -65,7 +65,7 @@ class SentryTransformer implements Transformer {
description: description,
);

span?.setData('http.method', options.method);
span?.setData('http.request.method', options.method);
// ignore: invalid_use_of_internal_member
span?.origin = SentryTraceOrigins.autoHttpDioTransformer;

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 @@ -46,7 +46,7 @@ class TracingClientAdapter implements HttpClientAdapter {
span = null;
}

span?.setData('http.method', options.method);
span?.setData('http.request.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['http.method'], 'GET');
expect(span.data['http.request.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 @@ -67,7 +67,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['http.method'], 'GET');
expect(span.data['http.request.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 @@ -96,7 +96,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['http.method'], 'GET');
expect(span.data['http.request.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 @@ -126,7 +126,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['http.method'], 'GET');
expect(span.data['http.request.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 @@ -43,7 +43,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['http.method'], 'GET');
expect(span.data['http.request.method'], 'GET');
expect(span.data['url'], 'https://example.com');
expect(span.data['http.query'], 'foo=bar');
expect(span.data['http.fragment'], 'baz');
Expand Down