@@ -118,20 +118,24 @@ class SentryHiveImpl implements SentryHiveInterface {
118
118
Uint8List ? bytes,
119
119
String ? collection,
120
120
List <int >? encryptionKey}) {
121
- return _asyncWrapInSpan ('openBox' , () async {
122
- final Box <E > box = await _hive.openBox (
123
- name,
124
- encryptionCipher: encryptionCipher,
125
- keyComparator: keyComparator,
126
- compactionStrategy: compactionStrategy,
127
- crashRecovery: crashRecovery,
128
- path: path,
129
- bytes: bytes,
130
- collection: collection,
131
- encryptionKey: encryptionKey,
132
- );
133
- return SentryBox (box, _hub);
134
- });
121
+ return _asyncWrapInSpan (
122
+ 'openBox' ,
123
+ () async {
124
+ final Box <E > box = await _hive.openBox (
125
+ name,
126
+ encryptionCipher: encryptionCipher,
127
+ keyComparator: keyComparator,
128
+ compactionStrategy: compactionStrategy,
129
+ crashRecovery: crashRecovery,
130
+ path: path,
131
+ bytes: bytes,
132
+ collection: collection,
133
+ encryptionKey: encryptionKey,
134
+ );
135
+ return SentryBox (box, _hub);
136
+ },
137
+ dbName: name,
138
+ );
135
139
}
136
140
137
141
@override
@@ -143,19 +147,23 @@ class SentryHiveImpl implements SentryHiveInterface {
143
147
String ? path,
144
148
String ? collection,
145
149
List <int >? encryptionKey}) {
146
- return _asyncWrapInSpan ('openLazyBox' , () async {
147
- final LazyBox <E > lazyBox = await _hive.openLazyBox (
148
- name,
149
- encryptionCipher: encryptionCipher,
150
- keyComparator: keyComparator,
151
- compactionStrategy: compactionStrategy,
152
- crashRecovery: crashRecovery,
153
- path: path,
154
- collection: collection,
155
- encryptionKey: encryptionKey,
156
- );
157
- return SentryLazyBox (lazyBox, _hub);
158
- });
150
+ return _asyncWrapInSpan (
151
+ 'openLazyBox' ,
152
+ () async {
153
+ final LazyBox <E > lazyBox = await _hive.openLazyBox (
154
+ name,
155
+ encryptionCipher: encryptionCipher,
156
+ keyComparator: keyComparator,
157
+ compactionStrategy: compactionStrategy,
158
+ crashRecovery: crashRecovery,
159
+ path: path,
160
+ collection: collection,
161
+ encryptionKey: encryptionKey,
162
+ );
163
+ return SentryLazyBox (lazyBox, _hub);
164
+ },
165
+ dbName: name,
166
+ );
159
167
}
160
168
161
169
@override
@@ -175,7 +183,10 @@ class SentryHiveImpl implements SentryHiveInterface {
175
183
// Helper
176
184
177
185
Future <T > _asyncWrapInSpan <T >(
178
- String description, Future <T > Function () execute) async {
186
+ String description,
187
+ Future <T > Function () execute, {
188
+ String ? dbName,
189
+ }) async {
179
190
final currentSpan = _hub.getSpan ();
180
191
final span = currentSpan? .startChild (
181
192
SentryHiveImpl .dbOp,
@@ -187,6 +198,10 @@ class SentryHiveImpl implements SentryHiveInterface {
187
198
188
199
span? .setData (SentryHiveImpl .dbSystemKey, SentryHiveImpl .dbSystem);
189
200
201
+ if (dbName != null ) {
202
+ span? .setData (SentryHiveImpl .dbNameKey, dbName);
203
+ }
204
+
190
205
try {
191
206
final result = await execute ();
192
207
span? .status = SpanStatus .ok ();
0 commit comments