-ESPP can be a significant hassle. After a few years, you can have dozens of different stock purchases, each at a different cost basis.
-ESPP significantly reduces the diversification of your portfolio. Not only is a large chunk of your money in one stock, it's your employer, and your employer's stock price and you continuing to have a job are probably positively correlated.
-You're tying your money up. ESPP programs generally have a vesting period, and even if they don't, if the stock goes up you need to hold on for it for a year to claim the profit as long-term capital gains. If you're not already planning on putting large chunk of your income away in savings, it may not be a good choice. If you have high-interest debt, you are likely better off paying that off before participating in ESPP.
-It ties your money up. Although I just listed this as a downside, it can also be an upside. An ESPP program means that your employer is handling putting your money into stocks for you. Humans are loss averse, so getting $(X+Y), and then losing $Y, feels worse than just getting $X in the first place. With ESPP, you're never seeing that money (other than in your gross pay), so you don't have to summon the will power to let it go. There's much less of a temptation of "oh, well, I can afford to splurge on this thing if I just don't put anything away in savings this month". You just get a lower take-home pay, you adjust to having that be how much you have to live on, and then when you retire it's "Hey, I have several hundred thousand dollars in this account! Awesome!"
-The discount, obviously. If you get a 15% discount on 10% of your income, that's 1.5% of your income. If you work 2000 hours a year, that's 30 hours of income. So the question is: are you willing to deal with the downsides in exchange for what's basically four days of paid vacation?
More specifically, do you recommend contributing to ESPP in max (10% of salary with 15% discount)? Or maybe it is only worth during certain times throughout the year?
Generally speaking, ESPP is either a good thing, in which case you should put in the max, or the downsides outweigh the advantages, in which case you shouldn't put any in. There aren't many cases where going half in, or dong it only some parts of the year, is the optimal choice. The tax hassles of keeping track of all the purchases is about the same regardless of how much you put in.
 It's probably actually 1.76%. That's because if you can spend 10% of your income buying stock at a 15% discount, then you can get stock worth 10%/.85 = 11.76% of your income, so there's a bonus of 1.76% of your income.