惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
Docker
I
InfoQ
L
LangChain Blog
阮一峰的网络日志
阮一峰的网络日志
Y
Y Combinator Blog
博客园_首页
Martin Fowler
Martin Fowler
宝玉的分享
宝玉的分享
A
About on SuperTechFans
Apple Machine Learning Research
Apple Machine Learning Research
Vercel News
Vercel News
T
The Blog of Author Tim Ferriss
C
Check Point Blog
B
Blog RSS Feed
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Engineering at Meta
Engineering at Meta
B
Blog
爱范儿
爱范儿
Stack Overflow Blog
Stack Overflow Blog
aimingoo的专栏
aimingoo的专栏
WordPress大学
WordPress大学
F
Fortinet All Blogs
月光博客
月光博客
GbyAI
GbyAI

Datadog | The Monitor blog

Introducing our open source AI-native SAST Instrument and monitor Boomi integration flows with OpenTelemetry and Datadog Not all index scans are equal: How we cut query latency by over 99% Platform engineering metrics: What to measure and what to ignore Integrate Recorded Future threat intelligence with Datadog Cloud SIEM CI/CD security: threat modeling using a MITRE-style threat matrix CI/CD security: How to secure your GitHub ecosystem Ingress NGINX is EOL: A practical guide for migrating to Kubernetes Gateway API Operating agentic AI with Amazon Bedrock AgentCore and Datadog LLM Observability: Lessons from NTT DATA Introducing the Datadog Code Security MCP Capture and analyze custom heatmaps in Session Replay Understand session replays faster with AI summaries and smart chapters Monitor ClickHouse query performance with Datadog Database Monitoring How we designed empathetic alert sounds for on-call engineers Search and act across Datadog to resolve issues faster with Bits Assistant Measure the business impact of every product change with Datadog Experiments Analyzing round trip query latency Configuring JavaScript caches for better performance Introducing Bits AI Dev Agent for Code Security Datadog achieves ISO 42001 certification for responsible AI Monitor Nutanix clusters, hosts, and VMs with Datadog Monitor Juniper Mist in Datadog A new Host Map for modern infrastructure Annotate traces to improve LLM quality with Datadog LLM Observability What’s new in Cloud SIEM: AI-powered investigations, enhanced threat intelligence, and scalable security operations Explore Kubernetes with native OpenTelemetry data Monitor Oracle Fusion Cloud Applications with Datadog Announcing the Datadog Terraform provider v4.0.0 Scaling Kubernetes workloads on custom metrics How to design cloud environments for AI-powered threat analysis
Analyze Ruby code performance with Datadog Continuous Pro...
Jordan Obey · 2022-02-02 · via Datadog | The Monitor blog

Ruby is an object-oriented programming language celebrated for its simple and easy-to-read syntax. It powers Ruby on Rails, the open source web development framework that streamlines common development tasks involved in building web applications. We’re pleased to announce that our Continuous Profiler, which provides low-overhead, code-level performance insights, is now generally available for Ruby applications. Continuous Profiler is always-on in production, so you can view how your Ruby code holds up under real-world conditions and identify which segments of your codebase can be optimized.

In this post, we’ll look at how Datadog Continuous Profiler enables you to easily view the resource usage of individual Ruby methods, correlate profiles and distributed traces, and compare profiles across versions, environments, and any other dimension you’re tracking in Datadog.

Quickly spot resource bottlenecks in your Ruby applications

As Ruby applications grow in size and complexity, identifying bottlenecks becomes more challenging. For instance, you may have hundreds of Rails routes mapped to controller actions and it may not be immediately clear which—if any—are consuming resources excessively. Continuous Profiler automatically collects representative stack traces and visualizes them in a flame graph, where each frame’s width corresponds to its resource usage. It also highlights the resource consumption of individual methods, libraries, and threads in a descending list, so you can isolate areas in need of optimization. For example, you may identify a Ruby method that is overconsuming CPU, which could indicate that it is executing more Active Record queries than you anticipated. To resolve this problem, you may consider implementing eager loading logic into your methods.

Datadog also provides a breakdown of resource consumption by endpoints (which are known as routes in Rails) so you can analyze how your application performs throughout different user journeys. For example, if you are investigating elevated CPU usage on an e-commerce application, you can use the endpoint list to see which workflow might be behind the issue. In the screenshot below, we can see significant CPU usage in the ProductsController#index endpoint.

Datadog provides a breakdown of resource consumption by endpoints so you can analyze code performance throughout different user journeys.

Correlate profiles and distributed traces

Continuous Profiler is tightly integrated with Datadog APM, which includes end-to-end distributed tracing across your entire stack. This means that if you’re investigating the traces of your Ruby application and you see requests with errors or high latency, you can dive into “Code Hotspots” and related profiles to uncover potential bottlenecks. The screenshot below, for instance, shows a 500 error on a request to the checkout endpoint of an e-commerce application. The “Code Hotspots” tab reveals that the initialize method took over a second to execute, which could point to an issue with the logic you’re using to instantiate a new checkout item.

use Code Hotspots to uncover potential bottlenecks.

Similarly, if a profile reveals an endpoint with excessive resource consumption, as was the case in the ProductsController#index endpoint in the previous section, you can pivot to APM to see which service or services are impacted.

Compare profiles to verify performance improvements

Once you’ve refactored your code to address a performance issue, it can be difficult to assess whether your changes have successfully reduced resource consumption—especially if you lack visibility into how your code has performed historically. Continuous Profiler integrates with Datadog Deployment Tracking, so you can compare profiles from previous versions of your codebase side-by-side with current profiles in order to verify that your updates were successful. Comparing profiles from different versions of your application is particularly useful when you’re deploying a canary release because it helps you confirm the efficacy of your changes before you deploy them widely.

In addition to comparing profiles from different versions of your application, you can also compare profiles that have different sets of Datadog tags. This capability allows you to compare performance, for example, between your staging and production environments, so you can identify and investigate any unexpected discrepancies.

A screenshot comparing profiles from two versions of a web-store service. The profiling data on the left is from version `11.4.1` and the data on the right is from version `11.4.2`.
A screenshot comparing profiles from two versions of a web-store service. The profiling data on the left is from version `11.4.1` and the data on the right is from version `11.4.2`.
A screenshot comparing profiles from two versions of a web-store service. The profiling data on the left is from version `11.4.1` and the data on the right is from version `11.4.2`.

Get started with Ruby profiling today

Datadog Continuous Profiler provides deep visibility into your codebase’s performance in production and is now generally available for Ruby, as well as Java, Python, and Go, with support for Node.js, .NET, and PHP on the way.

If you’re not already a Datadog customer, sign up for a 14-day free trial.