Skip to content
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Unreleased

* enrich Dart context with isolate name (#600)

# 6.1.0-alpha.1

* Performance API for Dart/Flutter (#530)
Expand Down
3 changes: 3 additions & 0 deletions dart/lib/src/enricher/io_enricher_event_processor.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'dart:async';
import 'dart:io';
import 'dart:isolate';

import '../event_processor.dart';
import '../protocol.dart';
Expand Down Expand Up @@ -63,6 +64,7 @@ class IoEnricherEventProcessor extends EventProcessor {
Map<String, dynamic> _getDartContext(bool includePii) {
final args = Platform.executableArguments;
final packageConfig = Platform.packageConfig;
final isolate = Isolate.current.debugName;

String? executable;
if (includePii) {
Expand All @@ -83,6 +85,7 @@ class IoEnricherEventProcessor extends EventProcessor {
return <String, dynamic>{
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,
Expand Down
2 changes: 2 additions & 0 deletions dart/test/enricher/io_enricher_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down