defaultOperationDetailsResolver static method
The default function to resolve details of a TracedOperation for its timeline events.
Implementation
static Map<String, Object?>? defaultOperationDetailsResolver(
TracedOperation operation,
) {
final details = <String, Object?>{};
if (operation is ChannelCallOp) {
details['callType'] = operation.name;
return details;
}
if (operation is OpenDatabaseOp) {
final directory = operation.config?.directory;
final withEncryptionKey = operation.config?.encryptionKey != null;
details['databaseName'] = operation.databaseName;
if (directory != null) {
details['directory'] = directory;
}
details['withEncryptionKey'] = withEncryptionKey;
return details;
}
if (operation is DatabaseOperationOp) {
details['databaseName'] = operation.database.name;
}
if (operation is DocumentOperationOp) {
details['documentId'] = operation.document.id;
}
if (operation is GetDocumentOp) {
details['documentId'] = operation.id;
}
if (operation is SaveDocumentOp) {
final concurrencyControl = operation.concurrencyControl;
if (concurrencyControl != null) {
details['concurrencyControl'] = concurrencyControl.name;
} else {
details['conflictHandler'] = true;
}
}
if (operation is DeleteDocumentOp) {
details['concurrencyControl'] = operation.concurrencyControl.name;
}
if (operation is QueryOperationOp) {
details['query'] =
operation.query.jsonRepresentation ?? operation.query.n1ql;
}
return details.isEmpty ? null : details;
}