McDonald's (NYSE:MCD) is perhaps the most successful restaurant chain of all time. Its stock has delivered market-crushing returns for decades, creating fortunes for its investors along the way.

Yet even the best businesses have risks, and it's important to study the threats that could derail your investments. That way, you won't be blindsided by them, and you can identify the key trends you should be watching.

Here, then, are three significant risks for McDonald's to be aware of.

A McDonald's restaurant

Image source: McDonald's.

1. Rising labor costs

Minimum wage increases apply constant pressure to McDonald's operating margins. In the fourth quarter, margins at company-operated restaurants in the U.S. declined 150 basis points, due mainly to higher labor costs. Moreover, CFO Kevin Ozan said during the fourth-quarter conference call that, in a normal inflationary environment, McDonald's needs to grow its comparable-store sales by 2% to 3% just to maintain its margins.

To combat this challenge, McDonald's is adding self-order kiosks to its restaurants, which could eventually help to reduce the number of workers it needs to operate its stores. The company also tends to increase prices at a measured pace in order to pass on escalating costs to consumers. But there's a limit to how much McDonald's can raise prices, and wage inflation will be an ongoing challenge.

2. Grocery deflation

At the same time, while labor costs are rising, grocery prices are falling. That's a problem for restaurants like McDonald's, because it makes dining out comparably more expensive than eating meals made at home.

Among fast-food chains, McDonald's is probably best positioned to weather this trend. Its massive scale gives it buying power: McDonald's can negotiate better prices from suppliers than its competitors due to the greater volume of goods it purchases. In addition, its reputation for low prices makes it a prime destination for budget-conscious consumers who do choose to dine out. The company is pressing this advantage with the launch of its new value menu, which contains an expanded selection of $1, $2, and $3 items.

Still, if grocery prices continue to get cheaper relative to restaurant prices, McDonald's could face lower guest counts.

3. Declining retail traffic

E-commerce presents another threat to McDonald's customer counts. Many traditional retailers are struggling with declining traffic in their stores. And as fewer people shop at these stores, traffic trends at restaurants located beside them are also likely to weaken.

In 2017, McDonald's did a commendable job of battling this trend. Its guest count rose by 1.5% in the fourth quarter and 1.9% for the full year. This marked the company's first full year of positive comparable guest count growth  since 2012.

McDonald's is investing heavily in mobile ordering technology and delivery service in its stores to make them more appealing to both drive-thru and stay-at-home consumers. These initiatives should only grow in importance, as the relentless growth of e-commerce is unlikely to abate in the foreseeable future.

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.