storageTrace<T> method

Future<T> storageTrace<T>({
  1. required String source,
  2. required String operation,
  3. required Future<T> run(),
  4. String? bucket,
  5. String? path,
  6. int? sizeBytes,
  7. String? contentType,
  8. Map<String, Object?>? meta,
  9. Object? projectResult(
    1. T
    )?,
  10. ISpectTraceConfig? config,
  11. String? correlationId,
})

Traces an async storage operation under storageCategory.

path becomes the log target; bucket, sizeBytes, and contentType are stored in meta.

Implementation

Future<T> storageTrace<T>({
  required String source,
  required String operation,
  required Future<T> Function() run,
  String? bucket,
  String? path,
  int? sizeBytes,
  String? contentType,
  Map<String, Object?>? meta,
  Object? Function(T)? projectResult,
  ISpectTraceConfig? config,
  String? correlationId,
}) =>
    traceCategoryAsync(
      category: storageCategory,
      source: source,
      operation: operation,
      target: path,
      meta: {
        if (bucket != null) 'bucket': bucket,
        if (sizeBytes != null) 'sizeBytes': sizeBytes,
        if (contentType != null) 'contentType': contentType,
        ...?meta,
      },
      run: run,
      projectResult: projectResult,
      config: config,
      correlationId: correlationId,
    );