Monitor how much sleep you are getting a night if you can. I would go after a week to ten days but if it's bothering you to the point where you can't function during the day, go whenever you really need them. If you can, try incorporating high intensity exercise such as running into your day first to see if that makes any difference.
Sleep is a very important part of human existence and if you aren't sleeping well/at all it can heavily impact your health. Without sleep you can be more prone to stress and anxiety, and even experience hallucinations. I don't know how you define not sleeping whether you mean you get a very small amount or you mean like none at all. But irregardless of which it is unless you are sick with something else like a stomach virus, after a couple of days I would personally go. The negative impact of lack of sleep on your health just builds up to quickly not to relatively quickly.
Any troubles with sleeping that you find unusual or concerning should be assessed by a doctor. Going without sleep for too long is extremely dangerous. Also, your body needs sleep to function best, so if you feel you are having trouble functioning, it's best to see a doctor, they may be able to give a medicine that can help you sleep. [2 days max in my personal opinion]
If you mean that you're having insomnia like symptoms, you should immediately go to your doctor with any concerns you may have or phone your local out of hours service like here, we have the NHS out of hours information station. You call 111 and you get put through to a professional who can give you advice but this is usually pointless. In all the times that I have called them, they have always told me to go see the person within the profession that I have a problem with; so I would strongly suggest going to your GP asap.
First you should ask yourself if you are under a lot of stress, if you are worrying about deadlines, or consuming copious amounts of caffeine. If you are not consuming lots of caffeine, if you are having trouble sleeping after 48hours then you should see your doctor.