Recession fears have sent the S&P 500 tumbling into a bear market this year, erasing more than $8 trillion in wealth. The broad-based index is currently 22% off its high, but many stocks have slipped much farther. For instance, Datadog (DDOG 1.28%) and Atlassian (TEAM -0.10%) are down 58% and 56%, respectively.

However, Wall Street says the stocks are oversold. Datadog and Atlassian have consensus ratings of "buy" among analysts. In fact, not a single analyst recommends selling shares of either company right now, and both stocks have more than 100% upside in the next 12 months, according to the highest price targets.

Of course, investors should never buy a stock based solely on its short-term price target. The market is too unpredictable over short periods of time. But Datadog and Atlassian are both backed by compelling long-term investment theses.

Here's what investors should know.

Datadog: The leader in application performance monitoring

Datadog specializes in observability and security. Its cloud platform provides real-time visibility across applications, networks, and infrastructure to help businesses keep their IT ecosystems secure and performant. Datadog offers over 500 prebuilt integrations that simplify customer adoption, and its platform leans on artificial intelligence (AI) to surface proactive alerts, identify performance problems, and automate root cause analysis.

Thanks to its robust portfolio and powerful AI engine, Datadog has achieved a strong market presence in several observability software categories. For instance, research company Gartner named Datadog a leader in application performance monitoring in June, and G2 Grid recently recognized Datadog as a leader in cloud infrastructure monitoring, log monitoring, and database monitoring.

Not surprisingly, those accolades have come alongside strong financial results. Revenue soared 79% to $1.4 billion over the past year, and free cash flow (FCF) more than doubled to $354 million. But enterprises spend more on digital transformation projects each year, and Datadog is a key enabler of digital transformation. To that end, management estimates its addressable market at $53 billion by 2025, leaving a long runaway for growth.

Shares currently trade at 19.2 times sales, a bargain compared to the three-year average of 38.6 times sales. That's why this beaten-down growth stock is worth buying today.

Atlassian: The gold standard in project management software

Atlassian specializes in team collaboration and productivity software. Its best known products -- Jira for project management and issue tracking, and Confluence for content organization and information sharing -- have become the gold standards in their respective end markets. But Atlassian is also a key player in adjacent software verticals like task management, enterprise planning, and IT service management.

That success stems in part from a somewhat unique self-service sales model. Atlassian primarily distributes its products online without direct sales support, relying instead on word-of-mouth marketing and expansion within organizations. That go-to-market strategy reduces sales expenses, allowing the company to focus on product quality and customer service to a greater degree than other vendors.

Thanks to that advantage, Atlassian has developed a portfolio of simple yet powerful software with utility across a broad range of workflows, and that has inspired strong demand. Over the past year, Atlassian grew its customer base 18%, and the average cloud customer spent 30% more. In turn, revenue rose 34% to $2.8 billion and the company generated FCF of $809 million. That equates to a solid FCF margin of 28.9%.

Turning to the future, investors have good reason to believe Atlassian can maintain its growth trajectory. Last year the company discontinued the sale of perpetual software licenses as part of its push toward cloud subscriptions. That transition should ultimately lead to more regular revenue growth, which means greater sales visibility for management.

More broadly, Atlassian puts its market opportunity at $29 billion, but that figure is growing at 14% annually. And with shares trading at 18.2 times sales -- a discount to the three-year average of 29.3 times sales -- this growth stock looks like a smart long-term investment.