Just about 12 months ago, tech stocks were the darlings of the market. Today, not many want to touch them with a 10-foot pole. The market's greed and fear can swing the pendulum of stock prices to extremes. Those overreactions, however, can create some great bargains for patient investors.

Two such bargains that seem especially attractive at today's prices are Alphabet (GOOG -1.96%) (GOOGL -1.97%) and Datadog (DDOG -1.43%). Here's why buying these high-quality businesses can produce great rewards for long-term investors.

Alphabet is a cash machine with strong upside

Alphabet, the parent company of Google, doesn't need much introduction. Its Google Search, Maps, Chrome, YouTube, Android operating system, and many other tools are central to daily life. The company has multiple products with more than a billion users, and many are undisputed leaders in their categories, such as Google Search with its 91% market share, Android with a 71% share of mobile operating systems, and Chrome with more than a 65% share among all web browsers globally. With that powerful ecosystem, Alphabet has become a go-to destination for advertisers.

With its efficient business model, from 2017 through 2021, Alphabet grew its revenue at a compound annual growth rate (CAGR) of 23.5%, while growing free cash flow at a CAGR of 29.4%. And that prolific cash flow was left over after Alphabet invested an incredible $123 billion in research and development and $108 billion in capital expenditure during the same period. The company still had $116 billion in cash and equivalents on its balance sheet as of Sept. 30, 2022. These numbers are very difficult for any rivals to compete with and have steadily extended the company's advantage.

Employee working in Google cloud data center.

Image source: Getty Images.

Despite those strong business fundamentals, some investors are still fretting over Alphabet's recently reported results for the third quarter of 2022, because year-over-year revenue grew only 6% and the operating margin fell to 25% from 32% a year ago. These results are certainly not inspiring on the surface, but they lack much-needed context.

Businesses are lowering their ad budgets in the face of growing uncertainty around the economy. Alphabet saw pullbacks in ad spending in Q3 from several sectors, including mortgage, lending, insurance, and crypto. Furthermore, foreign exchange headwinds lowered the company's year-over-year revenue growth by a notable 5%. Finally, Alphabet was overcoming a really tough year-over-year comparison, as sales had surged by a whopping 41% in Q3 2021. Considering all those factors, the company's modest growth in the recent quarter is not a big surprise.

Shares are down more than 35% relative to their high values from about a year ago and are currently priced toward the lower end of their 10-year values on price-to-earnings (19.1) and price-to-free cash flow (20.4) bases. Despite that drop, Alphabet has produced roughly 495% returns compared to the S&P 500's 193% over the past 10 years.

With its incredible product suite, rapidly growing Google Cloud platform, and potentially disruptive bets in developing tech such as autonomous driving, Alphabet looks set to continue its market-crushing ways.

Datadog is working to capture a bigger piece of the pie

In today's digital-first world, in which human interactions, commerce, entertainment, and most other aspects of life are controlled from our cell phones and computers, the reliability of the technology infrastructure and software apps is of paramount importance. Any outages or slowdowns in performance can be disastrous for businesses. Datadog plays a key role in ensuring companies run their tech operations smoothly by monitoring their platforms, proactively identifying key issues, and notifying the right people with the right information so that they can quickly fix those issues before business is disrupted.

Datadog's history of continuous product innovation is at the heart of its success. After establishing its roots in the technology monitoring space, the company has systematically expanded its scope to serve greater needs of organizations, including security and software engineering processes. In its recent Dash conference, Datadog announced 18 new products and features.

Datadog's ability to come up with fit-for-purpose products and the ease of onboarding its new products for customers have led to growing adoption. As of Sept. 30, 2022, 80% of its customers use two or more products, 40% use four or more, and 16% use six or more. The company's dollar-based net retention rate -- how much more existing customers are spending over the past year -- has now topped 130% for 21 consecutive quarters.

That customer adoption once again translated nicely to revenue growth in the third quarter. Revenue rose 61% year over year, reaching $437 million. The company added 800 new large customers (those paying over $100,000 annually) since last year, reaching 2,600. That robust growth in large customers gives more stability to Datadog's future cash flows. And unlike many fast-growing tech companies, Datadog is producing positive free cash flow, reaching $67 million in the recently reported quarter.

Shares of Datadog are not exactly cheap, because the market is willing to pay a premium for the company's promising future potential. Yet the stock is trading close to its all-time low price-to-sales valuation. With its relentless innovation and execution discipline, Datadog is in a great position to capture a larger portion of the $41 billion market opportunity that's expected to grow to $62 billion by 2026. I think buying a small stake in the company is likely to reward investors splendidly over the long run.