sse method

void sse({
  1. required String source,
  2. required String operation,
  3. String? url,
  4. String? eventType,
  5. String? eventId,
  6. Object? error,
  7. StackTrace? errorStackTrace,
  8. Map<String, Object?>? data,
  9. Map<String, Object?>? meta,
  10. ISpectTraceConfig? config,
  11. String? correlationId,
})

Logs an SSE event under sseCategory.

Success is inferred from error being null.

Implementation

void sse({
  required String source,
  required String operation,
  String? url,
  String? eventType,
  String? eventId,
  Object? error,
  StackTrace? errorStackTrace,
  Map<String, Object?>? data,
  Map<String, Object?>? meta,
  ISpectTraceConfig? config,
  String? correlationId,
}) {
  if (!isEnabled) return;
  traceCategory(
    category: sseCategory,
    source: source,
    operation: operation,
    target: url,
    key: eventId,
    error: error,
    errorStackTrace: errorStackTrace,
    success: error == null,
    meta: boundedTraceMeta(
      fields: {
        if (eventType != null) 'eventType': eventType,
        if (data != null) 'data': data,
      },
      overrides: meta,
    ),
    correlationId: correlationId,
    config: config,
  );
}