diff --git a/.craft.yml b/.craft.yml index 45554efb25..ac5e86e3c7 100644 --- a/.craft.yml +++ b/.craft.yml @@ -13,6 +13,7 @@ targets: sqflite: hive: drift: + isar: - name: github - name: registry sdks: diff --git a/.github/workflows/analyze.yml b/.github/workflows/analyze.yml index 6218eaa27a..bde8004cec 100644 --- a/.github/workflows/analyze.yml +++ b/.github/workflows/analyze.yml @@ -32,7 +32,7 @@ jobs: working-directory: ${{ inputs.package }} steps: - uses: actions/checkout@v4 - - uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d # pin@v1 + - uses: dart-lang/setup-dart@ca7e6fee45ffbd82b555a7ebfc236d2c86439f5b # pin@v1 if: ${{ inputs.sdk == 'dart' }} - uses: subosito/flutter-action@2783a3f08e1baf891508463f8c6653c258246225 # pin@v2.12.0 if: ${{ inputs.sdk == 'flutter' }} diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index 2eedf96de9..6ce30080f8 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -31,8 +31,7 @@ jobs: strategy: fail-fast: false matrix: - # TODO: exclude windows for now, because of failing tests in the new image runner - os: [ubuntu-latest, macos-latest] + os: [ubuntu-latest, windows-latest, macos-latest] sdk: [stable, beta] exclude: - os: windows-latest @@ -40,7 +39,7 @@ jobs: - os: macos-latest sdk: beta steps: - - uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d # pin@v1 + - uses: dart-lang/setup-dart@ca7e6fee45ffbd82b555a7ebfc236d2c86439f5b # pin@v1 with: sdk: ${{ matrix.sdk }} - uses: actions/checkout@v4 diff --git a/.github/workflows/diagrams.yml b/.github/workflows/diagrams.yml index a534112e8b..8b8cee500e 100644 --- a/.github/workflows/diagrams.yml +++ b/.github/workflows/diagrams.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest name: "Create class diagrams of all packages" steps: - - uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d # pin@v1 + - uses: dart-lang/setup-dart@ca7e6fee45ffbd82b555a7ebfc236d2c86439f5b # pin@v1 with: sdk: stable diff --git a/.github/workflows/dio.yml b/.github/workflows/dio.yml index c85ab43a1a..8f9fa41dc5 100644 --- a/.github/workflows/dio.yml +++ b/.github/workflows/dio.yml @@ -40,7 +40,7 @@ jobs: - os: macos-latest sdk: beta steps: - - uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d # pin@v1 + - uses: dart-lang/setup-dart@ca7e6fee45ffbd82b555a7ebfc236d2c86439f5b # pin@v1 with: sdk: ${{ matrix.sdk }} - uses: actions/checkout@v4 diff --git a/.github/workflows/e2e_dart.yml b/.github/workflows/e2e_dart.yml index 2d66eaf9e2..8a6953a0aa 100644 --- a/.github/workflows/e2e_dart.yml +++ b/.github/workflows/e2e_dart.yml @@ -37,7 +37,7 @@ jobs: matrix: sdk: [stable, beta] steps: - - uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d # pin@v1 + - uses: dart-lang/setup-dart@ca7e6fee45ffbd82b555a7ebfc236d2c86439f5b # pin@v1 with: sdk: ${{ matrix.sdk }} - uses: actions/checkout@v4 diff --git a/.github/workflows/file.yml b/.github/workflows/file.yml index 322c24b22e..3d1431f63b 100644 --- a/.github/workflows/file.yml +++ b/.github/workflows/file.yml @@ -41,7 +41,7 @@ jobs: - os: macos-latest sdk: beta steps: - - uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d # pin@v1 + - uses: dart-lang/setup-dart@ca7e6fee45ffbd82b555a7ebfc236d2c86439f5b # pin@v1 with: sdk: ${{ matrix.sdk }} - uses: actions/checkout@v4 diff --git a/.github/workflows/flutter-symbols.yml b/.github/workflows/flutter-symbols.yml index cf4af7c71c..4462ccccc8 100644 --- a/.github/workflows/flutter-symbols.yml +++ b/.github/workflows/flutter-symbols.yml @@ -21,7 +21,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d # pin@v1 + - uses: dart-lang/setup-dart@ca7e6fee45ffbd82b555a7ebfc236d2c86439f5b # pin@v1 - run: dart pub get @@ -33,7 +33,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d # pin@v1 + - uses: dart-lang/setup-dart@ca7e6fee45ffbd82b555a7ebfc236d2c86439f5b # pin@v1 - run: dart pub get diff --git a/.github/workflows/flutter.yml b/.github/workflows/flutter.yml index e21b884a01..8847114974 100644 --- a/.github/workflows/flutter.yml +++ b/.github/workflows/flutter.yml @@ -11,6 +11,7 @@ on: - "!**/class-diagram.svg" - "dart/**" - "flutter/**" + - "metrics/flutter.properties" jobs: cancel-previous-workflow: diff --git a/.github/workflows/flutter_test.yml b/.github/workflows/flutter_test.yml index 33990219b3..9a5b583420 100644 --- a/.github/workflows/flutter_test.yml +++ b/.github/workflows/flutter_test.yml @@ -57,7 +57,7 @@ jobs: uses: gradle/gradle-build-action@v2 - name: AVD cache - uses: actions/cache@v3 + uses: actions/cache@v4 id: avd-cache with: path: | diff --git a/.github/workflows/format-and-fix.yml b/.github/workflows/format-and-fix.yml index 89fc66cede..f7d0ec9cfb 100644 --- a/.github/workflows/format-and-fix.yml +++ b/.github/workflows/format-and-fix.yml @@ -30,7 +30,7 @@ jobs: working-directory: ${{ matrix.package.name }} steps: - uses: actions/checkout@v4 - - uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d # pin@v1 + - uses: dart-lang/setup-dart@ca7e6fee45ffbd82b555a7ebfc236d2c86439f5b # pin@v1 if: ${{ matrix.package.sdk == 'dart' }} - uses: subosito/flutter-action@2783a3f08e1baf891508463f8c6653c258246225 # pin@v2.12.0 if: ${{ matrix.package.sdk == 'flutter' }} diff --git a/.github/workflows/hive.yml b/.github/workflows/hive.yml index 1ff1a8483e..15bef1ecdb 100644 --- a/.github/workflows/hive.yml +++ b/.github/workflows/hive.yml @@ -40,7 +40,7 @@ jobs: - os: macos-latest sdk: beta steps: - - uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d # pin@v1 + - uses: dart-lang/setup-dart@ca7e6fee45ffbd82b555a7ebfc236d2c86439f5b # pin@v1 with: sdk: ${{ matrix.sdk }} - uses: actions/checkout@v4 diff --git a/.github/workflows/logging.yml b/.github/workflows/logging.yml index d6af6538bd..4e39833caa 100644 --- a/.github/workflows/logging.yml +++ b/.github/workflows/logging.yml @@ -40,7 +40,7 @@ jobs: - os: macos-latest sdk: beta steps: - - uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d # pin@v1 + - uses: dart-lang/setup-dart@ca7e6fee45ffbd82b555a7ebfc236d2c86439f5b # pin@v1 with: sdk: ${{ matrix.sdk }} - uses: actions/checkout@v4 diff --git a/.github/workflows/metrics.yml b/.github/workflows/metrics.yml index c190889723..1e383a93ea 100644 --- a/.github/workflows/metrics.yml +++ b/.github/workflows/metrics.yml @@ -65,7 +65,7 @@ jobs: - run: ./metrics/prepare.sh - - uses: actions/cache@v3 + - uses: actions/cache@v4 id: app-plain-cache with: path: ${{ matrix.appPlain }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 46f27f34fb..a9f9b4efb1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ ### Features +- Performance monitoring support for isar ([#1726](https://github.com/getsentry/sentry-dart/pull/1726)) +- Tracing without performance for Dio integration ([#1837](https://github.com/getsentry/sentry-dart/pull/1837)) - Accept `Map` in `Hint` class ([#1807](https://github.com/getsentry/sentry-dart/pull/1807)) - Please check if everything works as expected when using `Hint` - Factory constructor `Hint.withMap(Map map)` now takes `Map` instead of `Map` @@ -20,7 +22,6 @@ - Set `options.spotlight = Spotlight(enabled: true)` to enable Spotlight - Add `ConnectivityIntegration` for web ([#1765](https://github.com/getsentry/sentry-dart/pull/1765)) - We only get the info if online/offline on web platform. The added breadcrumb is set to either `wifi` or `none`. -- APM for isar ([#1726](https://github.com/getsentry/sentry-dart/pull/1726)) - Add isar breadcrumbs ([#1800](https://github.com/getsentry/sentry-dart/pull/1800)) - Starting with Flutter 3.16, Sentry adds the [`appFlavor`](https://api.flutter.dev/flutter/services/appFlavor-constant.html) to the `flutter_context` ([#1799](https://github.com/getsentry/sentry-dart/pull/1799)) - Add beforeScreenshotCallback to SentryFlutterOptions ([#1805](https://github.com/getsentry/sentry-dart/pull/1805)) diff --git a/dio/lib/src/tracing_client_adapter.dart b/dio/lib/src/tracing_client_adapter.dart index 19a003b633..0c8def1442 100644 --- a/dio/lib/src/tracing_client_adapter.dart +++ b/dio/lib/src/tracing_client_adapter.dart @@ -51,12 +51,12 @@ class TracingClientAdapter implements HttpClientAdapter { ResponseBody? response; try { - if (span != null) { - if (containsTargetOrMatchesRegExp( - // ignore: invalid_use_of_internal_member - _hub.options.tracePropagationTargets, - options.uri.toString(), - )) { + if (containsTargetOrMatchesRegExp( + // ignore: invalid_use_of_internal_member + _hub.options.tracePropagationTargets, + options.uri.toString(), + )) { + if (span != null) { addSentryTraceHeaderFromSpan(span, options.headers); addBaggageHeaderFromSpan( span, @@ -64,6 +64,25 @@ class TracingClientAdapter implements HttpClientAdapter { // ignore: invalid_use_of_internal_member logger: _hub.options.logger, ); + } else { + // ignore: invalid_use_of_internal_member + final scope = _hub.scope; + // ignore: invalid_use_of_internal_member + final propagationContext = scope.propagationContext; + + final traceHeader = propagationContext.toSentryTrace(); + addSentryTraceHeader(traceHeader, options.headers); + + final baggage = propagationContext.baggage; + if (baggage != null) { + final baggageHeader = SentryBaggageHeader.fromBaggage(baggage); + addBaggageHeader( + baggageHeader, + options.headers, + // ignore: invalid_use_of_internal_member + logger: _hub.options.logger, + ); + } } } diff --git a/dio/test/tracing_client_adapter_test.dart b/dio/test/tracing_client_adapter_test.dart index b758c5a765..f67ec4c14d 100644 --- a/dio/test/tracing_client_adapter_test.dart +++ b/dio/test/tracing_client_adapter_test.dart @@ -127,25 +127,48 @@ void main() { ); }); - test('captured span do not add headers if NoOp', () async { + test('do not throw if no span bound to the scope', () async { + final sut = fixture.getSut( + client: fixture.getClient(statusCode: 200, reason: 'OK'), + ); + + await sut.get(requestOptions); + }); + + test('set headers from propagationContext when tracing is disabled', + () async { + fixture._options.enableTracing = false; final sut = fixture.getSut( client: fixture.getClient(statusCode: 200, reason: 'OK'), ); - await fixture._hub - .configureScope((scope) => scope.span = NoOpSentrySpan()); + + final propagationContext = fixture._hub.scope.propagationContext; + propagationContext.baggage = SentryBaggage({'foo': 'bar'}); final response = await sut.get(requestOptions); - expect(response.headers['baggage'], null); - expect(response.headers['sentry-trace'], null); + expect( + response.headers['sentry-trace'], + [propagationContext.toSentryTrace().value], + ); + expect(response.headers['baggage'], ['foo=bar']); }); - test('do not throw if no span bound to the scope', () async { + test('set headers from propagationContext when no transaction', () async { final sut = fixture.getSut( client: fixture.getClient(statusCode: 200, reason: 'OK'), ); - await sut.get(requestOptions); + final propagationContext = fixture._hub.scope.propagationContext; + propagationContext.baggage = SentryBaggage({'foo': 'bar'}); + + final response = await sut.get(requestOptions); + + expect( + response.headers['sentry-trace'], + [propagationContext.toSentryTrace().value], + ); + expect(response.headers['baggage'], ['foo=bar']); }); }); } diff --git a/flutter/ios/sentry_flutter.podspec b/flutter/ios/sentry_flutter.podspec index 1dc2c0fa06..03220ac7bf 100644 --- a/flutter/ios/sentry_flutter.podspec +++ b/flutter/ios/sentry_flutter.podspec @@ -12,7 +12,7 @@ Sentry SDK for Flutter with support to native through sentry-cocoa. :tag => s.version.to_s } s.source_files = 'Classes/**/*' s.public_header_files = 'Classes/**/*.h' - s.dependency 'Sentry/HybridSDK', '8.18.0' + s.dependency 'Sentry/HybridSDK', '8.19.0' s.ios.dependency 'Flutter' s.osx.dependency 'FlutterMacOS' s.ios.deployment_target = '11.0' diff --git a/metrics/flutter.properties b/metrics/flutter.properties index d423be6b0c..8a0f53ceea 100644 --- a/metrics/flutter.properties +++ b/metrics/flutter.properties @@ -1,2 +1,2 @@ -version = 3.16.7 +version = 3.16.8 repo = https://github.com/flutter/flutter