Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[starfish] add http.request.method attribute to http spans #1633

Merged
merged 2 commits into from
Sep 8, 2023
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
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
Loading