-
Notifications
You must be signed in to change notification settings - Fork 0
trace
awekrx edited this page May 29, 2026
·
1 revision
import { trace } from '@dev-suite/decorators/trace'
method
Emit structured start/success/error events around method execution.
- Scattered tracing spans in methods
- Manual lifecycle events with inconsistent payload
class WorkerService {
async run(taskId: string) {
tracer.emit({ phase: 'start', taskId });
try {
const result = await this.engine.run(taskId);
tracer.emit({ phase: 'success', taskId });
return result;
} catch (error) {
tracer.emit({ phase: 'error', taskId, error });
throw error;
}
}
}import { trace } from '@dev-suite/decorators/trace';
class WorkerService {
@trace({ reporter: (event) => tracer.emit(event) })
async run(taskId: string) {
return this.engine.run(taskId);
}
}- Unified trace lifecycle around all method outcomes.
- Cleaner business logic with less instrumentation noise.
class ReconciliationService {
async reconcile(batchId: string) {
telemetry.start('reconcile', { batchId });
const result = await this.core.reconcile(batchId);
telemetry.end('reconcile', { batchId, count: result.count });
return result;
}
}import { trace } from '@dev-suite/decorators/trace';
class ReconciliationService {
@trace({ reporter: (event) => telemetry.emit('reconcile', event) })
async reconcile(batchId: string) {
return this.core.reconcile(batchId);
}
}- Reporter integration can adapt to current telemetry stack.
- Consistent event schema improves debugging.