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

feat(js-sdk): support release health #2546

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
d4e3de8
update
buenaflor Dec 11, 2024
2893b30
update
buenaflor Dec 11, 2024
d7e1b8e
update test
buenaflor Dec 11, 2024
6ed7147
update
buenaflor Dec 11, 2024
1a5c34a
update
buenaflor Dec 11, 2024
5ab1502
update
buenaflor Dec 11, 2024
acb247e
update
buenaflor Dec 11, 2024
0f75cdb
update doc
buenaflor Dec 11, 2024
d485d8a
update
buenaflor Dec 12, 2024
cc49e7d
update
buenaflor Dec 12, 2024
b1bfe7a
update
buenaflor Dec 12, 2024
cf80fe5
update test
buenaflor Dec 12, 2024
de637d7
update
buenaflor Dec 12, 2024
8afce00
update tests
buenaflor Dec 12, 2024
42e2c2a
use tryCatchSync
buenaflor Dec 12, 2024
7ef97ee
formatting
buenaflor Dec 12, 2024
e4931b1
fix sentry_flutter_test
buenaflor Dec 12, 2024
d51b5d0
Merge branch 'feat/js-sdk-integration' into feat/js-sentry-api
buenaflor Dec 12, 2024
92c8072
fix analyze
buenaflor Dec 12, 2024
8a54e09
update test
buenaflor Dec 12, 2024
096f55d
fix tests
buenaflor Dec 12, 2024
460ffd4
Merge branch 'feat/js-sdk-integration' into feat/js-sentry-api
buenaflor Dec 16, 2024
78d0785
update test
buenaflor Dec 16, 2024
43564dc
Merge branch 'feat/js-sdk-integration' into feat/js-sentry-api
buenaflor Dec 16, 2024
0c884d9
update test
buenaflor Dec 16, 2024
800e032
update scripts
buenaflor Dec 16, 2024
fe035aa
ignore sentry_web in coverage
buenaflor Dec 16, 2024
ea4a155
update test
buenaflor Dec 16, 2024
0da8b2e
temporary
buenaflor Dec 16, 2024
a51c318
update
buenaflor Dec 17, 2024
cf41126
test
buenaflor Dec 18, 2024
6caf42b
update tests
buenaflor Dec 18, 2024
0359596
update test with mocks
buenaflor Dec 18, 2024
fc5cc2a
fix analyze
buenaflor Dec 18, 2024
8d2efd6
update
buenaflor Dec 18, 2024
005b352
update names
buenaflor Dec 18, 2024
efbe0fd
fix test
buenaflor Dec 18, 2024
866d884
update
buenaflor Dec 18, 2024
bff8518
update integration
buenaflor Dec 18, 2024
4da1805
update comment
buenaflor Dec 18, 2024
f93cffd
update flutter enricher
buenaflor Dec 18, 2024
7f8f4e7
update test
buenaflor Dec 18, 2024
30fdb89
update
buenaflor Dec 18, 2024
8f6cda3
update flag name
buenaflor Dec 18, 2024
90e203c
update
buenaflor Dec 18, 2024
0b24e26
update binding creation condition
buenaflor Dec 19, 2024
893fd2f
update
buenaflor Dec 19, 2024
b3ab858
update integration test
buenaflor Dec 23, 2024
67eed39
fix tests
buenaflor Dec 23, 2024
8815b03
Merge branch 'feat/js-sdk-integration' into feat/js-sentry-api
buenaflor Dec 23, 2024
d5427e3
add support for sending
buenaflor Dec 23, 2024
e6245f9
update
buenaflor Dec 23, 2024
dc36513
fix attachments
buenaflor Dec 24, 2024
49f34cb
update, move LoadReleaseIntegration to before native sdk init
buenaflor Dec 24, 2024
0cd4407
update
buenaflor Dec 24, 2024
3d35dc1
add comment
buenaflor Jan 2, 2025
b5b702e
set js transport in web integration
buenaflor Jan 2, 2025
a60012f
remove native folder
buenaflor Jan 2, 2025
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
2 changes: 1 addition & 1 deletion .github/workflows/flutter_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,6 @@ jobs:

# Run the tests
flutter drive \
--driver=integration_test/test_driver/web_driver.dart \
--driver=integration_test/test_driver/driver.dart \
--target=integration_test/web_sdk_test.dart \
-d chrome
70 changes: 35 additions & 35 deletions dart/lib/sentry.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,60 +5,60 @@
/// A pure Dart client for Sentry.io crash reporting.
library sentry_dart;

export 'src/run_zoned_guarded_integration.dart';
export 'src/event_processor.dart';
export 'src/exception_cause.dart';
// exception extraction
export 'src/exception_cause_extractor.dart';
export 'src/exception_stacktrace_extractor.dart';
export 'src/exception_type_identifier.dart';
export 'src/hint.dart';
export 'src/http_client/sentry_http_client.dart';
export 'src/http_client/sentry_http_client_error.dart';
export 'src/hub.dart';
// useful for tests
export 'src/hub_adapter.dart';
export 'src/platform_checker.dart';
export 'src/integration.dart';
export 'src/noop_isolate_error_integration.dart'
if (dart.library.io) 'src/isolate_error_integration.dart';
export 'src/performance_collector.dart';
export 'src/platform_checker.dart';
export 'src/protocol.dart';
// feedback
export 'src/protocol/sentry_feedback.dart';
// proxy
export 'src/protocol/sentry_proxy.dart';
export 'src/run_zoned_guarded_integration.dart';
export 'src/scope.dart';
export 'src/scope_observer.dart';
export 'src/sentry.dart';
export 'src/sentry_attachment/sentry_attachment.dart';
export 'src/sentry_baggage.dart';
export 'src/sentry_client.dart';
export 'src/sentry_envelope.dart';
export 'src/sentry_envelope_item.dart';
export 'src/sentry_client.dart';
export 'src/sentry_options.dart';
// ignore: invalid_export_of_internal_element
export 'src/sentry_span_operations.dart';
// ignore: invalid_export_of_internal_element
export 'src/sentry_trace_origins.dart';
export 'src/sentry_user_feedback.dart';
// constants
export 'src/span_data_convention.dart';
// spotlight debugging
export 'src/spotlight.dart';
// useful for integrations
export 'src/throwable_mechanism.dart';
export 'src/transport/transport.dart';
export 'src/integration.dart';
export 'src/event_processor.dart';
export 'src/http_client/sentry_http_client.dart';
export 'src/http_client/sentry_http_client_error.dart';
export 'src/sentry_attachment/sentry_attachment.dart';
export 'src/sentry_user_feedback.dart';
export 'src/utils/tracing_utils.dart';
export 'src/performance_collector.dart';
// tracing
export 'src/tracing.dart';
export 'src/hint.dart';
export 'src/transport/transport.dart';
export 'src/type_check_hint.dart';
export 'src/sentry_baggage.dart';
// exception extraction
export 'src/exception_cause_extractor.dart';
export 'src/exception_cause.dart';
export 'src/exception_stacktrace_extractor.dart';
export 'src/exception_type_identifier.dart';
// URL
// ignore: invalid_export_of_internal_element
export 'src/utils/http_sanitizer.dart';
// ignore: invalid_export_of_internal_element
export 'src/utils/url_details.dart';
export 'src/utils.dart';
// ignore: invalid_export_of_internal_element
export 'src/utils/http_header_utils.dart';
// URL
// ignore: invalid_export_of_internal_element
export 'src/sentry_trace_origins.dart';
// ignore: invalid_export_of_internal_element
export 'src/sentry_span_operations.dart';
export 'src/utils/http_sanitizer.dart';
export 'src/utils/tracing_utils.dart';
// ignore: invalid_export_of_internal_element
export 'src/utils.dart';
// spotlight debugging
export 'src/spotlight.dart';
// proxy
export 'src/protocol/sentry_proxy.dart';
// feedback
export 'src/protocol/sentry_feedback.dart';
// constants
export 'src/span_data_convention.dart';
export 'src/utils/url_details.dart';
9 changes: 7 additions & 2 deletions dart/lib/src/client_reports/client_report.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import 'package:meta/meta.dart';

import '../../sentry.dart';
import 'discarded_event.dart';
import '../utils.dart';

@internal
class ClientReport {
class ClientReport implements SentryEnvelopeItemPayload {
ClientReport(this.timestamp, this.discardedEvents);

final DateTime? timestamp;
Expand All @@ -27,4 +27,9 @@ class ClientReport {

return json;
}

@override
Future getPayload() {
return Future.value(toJson());
}
}
21 changes: 7 additions & 14 deletions dart/lib/src/platform_checker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,13 @@ class PlatformChecker {
}

/// Indicates whether a native integration is available.
bool get hasNativeIntegration {
if (isWeb) {
return false;
}
// We need to check the platform after we checked for web, because
// the OS checks return true when the browser runs on the checked platform.
// Example: platform.isAndroid return true if the browser is used on an
// Android device.
return platform.isAndroid ||
platform.isIOS ||
platform.isMacOS ||
platform.isWindows ||
platform.isLinux;
}
bool get hasNativeIntegration =>
isWeb ||
platform.isAndroid ||
platform.isIOS ||
platform.isMacOS ||
platform.isWindows ||
platform.isLinux;

static bool _isWebWithWasmSupport() {
if (const bool.hasEnvironment(_jsUtil)) {
Expand Down
15 changes: 10 additions & 5 deletions dart/lib/src/protocol/sentry_event.dart
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import 'package:meta/meta.dart';
import 'package:collection/collection.dart';
import 'package:meta/meta.dart';

import '../protocol.dart';
import '../throwable_mechanism.dart';
import '../utils.dart';
import '../../sentry.dart';
import 'access_aware_map.dart';

/// An event to be reported to Sentry.io.
@immutable
class SentryEvent with SentryEventLike<SentryEvent> {
class SentryEvent
with SentryEventLike<SentryEvent>
implements SentryEnvelopeItemPayload {
/// Creates an event.
SentryEvent({
SentryId? eventId,
Expand Down Expand Up @@ -418,4 +418,9 @@ class SentryEvent with SentryEventLike<SentryEvent> {
SentryStackTrace? get stacktrace =>
exceptions?.firstWhereOrNull((e) => e.stackTrace != null)?.stackTrace ??
threads?.firstWhereOrNull((t) => t.stacktrace != null)?.stacktrace;

@override
Future<dynamic> getPayload() {
return Future.value(toJson());
}
}
10 changes: 7 additions & 3 deletions dart/lib/src/sentry_attachment/sentry_attachment.dart
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import 'dart:async';
import 'dart:typed_data';

import '../protocol/sentry_view_hierarchy.dart';
import '../utils.dart';
import '../../sentry.dart';

// https://develop.sentry.dev/sdk/features/#attachments
// https://develop.sentry.dev/sdk/envelopes/#attachment

typedef ContentLoader = FutureOr<Uint8List> Function();

/// Arbitrary content which gets attached to an event.
class SentryAttachment {
class SentryAttachment implements SentryEnvelopeItemPayload {
/// Standard attachment without special meaning.
static const String typeAttachmentDefault = 'event.attachment';

Expand Down Expand Up @@ -122,4 +121,9 @@ class SentryAttachment {
/// If true, attachment should be added to every transaction.
/// Defaults to false.
final bool addToTransactions;

@override
Future<dynamic> getPayload() async {
return await bytes;
}
}
2 changes: 1 addition & 1 deletion dart/lib/src/sentry_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import 'dart:async';
import 'dart:math';

import 'package:meta/meta.dart';
import 'type_check_hint.dart';

import 'client_reports/client_report_recorder.dart';
import 'client_reports/discard_reason.dart';
Expand All @@ -27,6 +26,7 @@ import 'transport/http_transport.dart';
import 'transport/noop_transport.dart';
import 'transport/rate_limiter.dart';
import 'transport/spotlight_http_transport.dart';
import 'type_check_hint.dart';
import 'utils/isolate_utils.dart';
import 'utils/regex_utils.dart';
import 'utils/stacktrace_utils.dart';
Expand Down
7 changes: 5 additions & 2 deletions dart/lib/src/sentry_envelope_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@ import 'sentry_item_type.dart';
import 'sentry_user_feedback.dart';
import 'utils.dart';

abstract class SentryEnvelopeItemPayload {
Future<dynamic> getPayload();
}

/// Item holding header information and JSON encoded data.
class SentryEnvelopeItem {
/// The original, non-encoded object, used when direct access to the source data is needed.
Object? originalObject;
SentryEnvelopeItemPayload? originalObject;

SentryEnvelopeItem(this.header, this.dataFactory, {this.originalObject});

Expand Down Expand Up @@ -102,7 +106,6 @@ class SentryEnvelopeItem {
return SentryEnvelopeItem(
header,
dataFactory,
originalObject: buckets,
);
}

Expand Down
2 changes: 1 addition & 1 deletion dart/lib/src/sentry_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ class SentryOptions {
/// breadcrumbs.
/// In a Flutter environment, this setting also toggles recording of `debugPrint` calls.
/// `debugPrint` calls are only recorded in release builds, though.
bool enablePrintBreadcrumbs = true;
bool enablePrintBreadcrumbs = false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change needed to be part of the web support? it could have side effects of itself worth tracking as a separate change probably done before the big web support.

Copy link
Contributor Author

@buenaflor buenaflor Jan 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is temporary for testing, on web with the js sdk integration this seems to run into a recursion so I've disabled it for now I will revert it back after I fixed the issue


/// If [platformChecker] is provided, it is used get the environment.
/// This is useful in tests. Should be an implementation of [PlatformChecker].
Expand Down
9 changes: 7 additions & 2 deletions dart/lib/src/sentry_user_feedback.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import 'package:meta/meta.dart';

import 'protocol.dart';
import '../sentry.dart';
import 'protocol/access_aware_map.dart';

@Deprecated('Will be removed in a future version. Use [SentryFeedback] instead')
class SentryUserFeedback {
class SentryUserFeedback implements SentryEnvelopeItemPayload {
SentryUserFeedback({
required this.eventId,
this.name,
Expand Down Expand Up @@ -66,4 +66,9 @@ class SentryUserFeedback {
unknown: unknown,
);
}

@override
Future<dynamic> getPayload() {
return Future.value(toJson());
}
}
12 changes: 6 additions & 6 deletions dart/lib/src/transport/http_transport.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ import 'dart:async';
import 'dart:convert';

import 'package:http/http.dart';
import '../utils/transport_utils.dart';
import 'http_transport_request_handler.dart';

import '../http_client/client_provider.dart'
if (dart.library.io) '../http_client/io_client_provider.dart';
import '../noop_client.dart';
import '../protocol.dart';
import '../sentry_options.dart';
import '../sentry_envelope.dart';
import 'transport.dart';
import '../sentry_options.dart';
import '../utils/transport_utils.dart';
import 'http_transport_request_handler.dart';
import 'rate_limiter.dart';
import '../http_client/client_provider.dart'
if (dart.library.io) '../http_client/io_client_provider.dart';
import 'transport.dart';

/// A transport is in charge of sending the event to the Sentry server.
class HttpTransport implements Transport {
Expand Down
3 changes: 0 additions & 3 deletions flutter/example/integration_test/test_driver/web_driver.dart

This file was deleted.

2 changes: 2 additions & 0 deletions flutter/example/integration_test/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ FutureOr<void> restoreFlutterOnErrorAfter(FutureOr<void> Function() fn) async {
originalOnError?.call(details);
};
}

const fakeDsn = 'https://abc@def.ingest.sentry.io/1234567';
Loading
Loading