Datadog (DDOG -0.37%) reported second-quarter earnings on Aug. 4, and the results were exceptional. Despite macroeconomic headwinds, this digital infrastructure observability platform didn't see much of a slowdown in its business and continued to post robust results. 

That said, investors still didn't think it was enough. Shares fell slightly after the company reported earnings, leaving Datadog down almost 40% in 2022. If you're a long-term investor looking to buy and hold high-quality businesses, Datadog might be for you, given this year-to-date slump.

Person thinking about a problem at a desk.

Image source: Getty Images.

Datadog kept chugging along

Datadog leads offers over 30 tools to help businesses ensure their cloud infrastructure and digital applications run smoothly. A company wants its digital applications to function for consumers, no matter the economic environment. Therefore, Datadog is a cornerstone of a business's operations, and if a company has to reduce spending, it's unlikely it'll be through Datadog. 

This quarter proved that: Datadog barely saw any indication of worsening economic conditions. Second-quarter revenue soared 74% year over year to $406 million, driven by increasing spending. The company's net retention rate surpassed 130% for the 20th consecutive quarter, while churn stayed in the mid-to-low single digits.

What was even more impressive was management's guidance. The company raised its full-year expectations for revenue, now anticipating it will generate about $1.62 billion in sales this year. This represents a 57% year-over-year increase, showing that management doesn't foresee current macroeconomic headwinds significantly impacting the business this year.

Even this guidance, however, might understate the company's resiliency. Management made it clear this guidance was conservative, so come year's end, Datadog could potentially report even stronger results.

The minor stumbles

While it isn't a surprise Datadog saw continued demand this quarter, one of the concerns was that the company would see less additional spending from existing customers. That wasn't a major problem, but there were minor signs of weakness in some customer cohorts. As co-founder and CEO Olivier Pomel explains, Datadog saw spending expand at a slower rate in certain sectors:

We saw our larger spending customers continue to grow but at a rate that was lower than historical levels. This effect was more pronounced in certain industries, particularly in consumer discretionary, which includes e-commerce and food and delivery customers.

Even so, this wasn't enough to be noticeable in the company's financials. The number of customers spending over $100,000 annually continued to improve, jumping 54% year over year to 2,420 during the quarter.

Even if this becomes a more widespread problem, Datadog has the cash to continue investing and to maintain its dominant position in the industry. Over the past six months, Datadog has generated $190 million in free cash flow, representing a margin of almost 25%. This lucrative cash generation can sustain the business through a downturn, while rivals might have to cut back on their investments to stay afloat. Therefore, Datadog might come out even stronger relative to the competition.

This top dog still looks appealing

To be clear, this stock isn't cheap. Shares trade at 22 times projected 2022 sales, which isn't a bargain by any stretch of the imagination. That said, you're paying for a high-quality business. This cash-flow positive leader is critical to its customers, and as long as companies care about digital application and cloud infrastructure performance, Datadog looks poised to thrive. 

With its large product portfolio, Datadog is creating high switching costs and a robust ecosystem that makes it hard for customers to leave. That sets it up to capture a significant share of the $53 billion addressable market management expects for 2025.

This quarter was an example of Datadog flexing its competitive advantages and the essential nature of its service. With shares down substantially in 2022, consider adding this top-notch business to your portfolio.