diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a0f37ebc3..d8e5ef206d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Unreleased +* enrich Dart context with isolate name (#600) + # 6.1.0-alpha.1 * Performance API for Dart/Flutter (#530) diff --git a/dart/lib/src/enricher/io_enricher_event_processor.dart b/dart/lib/src/enricher/io_enricher_event_processor.dart index da27e06e2c..af010b8a52 100644 --- a/dart/lib/src/enricher/io_enricher_event_processor.dart +++ b/dart/lib/src/enricher/io_enricher_event_processor.dart @@ -1,5 +1,6 @@ import 'dart:async'; import 'dart:io'; +import 'dart:isolate'; import '../event_processor.dart'; import '../protocol.dart'; @@ -63,6 +64,7 @@ class IoEnricherEventProcessor extends EventProcessor { Map _getDartContext(bool includePii) { final args = Platform.executableArguments; final packageConfig = Platform.packageConfig; + final isolate = Isolate.current.debugName; String? executable; if (includePii) { @@ -83,6 +85,7 @@ class IoEnricherEventProcessor extends EventProcessor { return { if (packageConfig != null) 'package_config': packageConfig, 'number_of_processors': Platform.numberOfProcessors, + if (isolate != null) 'isolate': isolate, // The following information could potentially contain PII if (includePii) ...{ 'executable': executable, diff --git a/dart/test/enricher/io_enricher_test.dart b/dart/test/enricher/io_enricher_test.dart index c93cb1036a..b9d0f33c08 100644 --- a/dart/test/enricher/io_enricher_test.dart +++ b/dart/test/enricher/io_enricher_test.dart @@ -78,6 +78,7 @@ void main() { final dartContext = event.contexts['dart_context']; expect(dartContext, isNotNull); + expect(dartContext['isolate'], isNotNull); expect(dartContext['number_of_processors'], isNotNull); // Getting the executable sometimes throws //expect(dartContext['executable'], isNotNull); @@ -93,6 +94,7 @@ void main() { final dartContext = event.contexts['dart_context']; expect(dartContext, isNotNull); expect(dartContext['number_of_processors'], isNotNull); + expect(dartContext['isolate'], isNotNull); expect(dartContext['executable'], isNull); expect(dartContext['resolved_executable'], isNull); expect(dartContext['script'], isNull);