Skip to content

Commit

Permalink
[starfish] add http.request.method attribute to http spans (#1633)
Browse files Browse the repository at this point in the history
* add http.request.method to http spans

* update changelog
  • Loading branch information
buenaflor authored Sep 8, 2023
1 parent 9442665 commit 4ad2751
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 10 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 @@

### Enhancements

- Add http.request.method attribute to http spans data ([#1633](https://github.com/getsentry/sentry-dart/pull/1633))
- Add db.system and db.name attributes to db spans data ([#1629](https://github.com/getsentry/sentry-dart/pull/1629))

### Features
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 @@ -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

0 comments on commit 4ad2751

Please sign in to comment.