OptionaloptsOrFactory: TracedInputStatic WithTraceOptions or a factory that receives TracedCallContext and returns options per call.
class UserService {
@traced()
async getUser(id: string) { // span = "UserService.getUser"
}
@traced({ name: "custom-op", kind: SpanKind.CLIENT })
async fetchExternal() { // span = "custom-op"
}
@traced(({ args }) => ({
attributes: { "user.id": String(args[0]) },
}))
async updateUser(id: string) { // span = "UserService.updateUser"
}
}
TC39 Stage 3 method decorator that wraps the method body in a withTrace span.