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

推荐订阅源

美团技术团队
人人都是产品经理
人人都是产品经理
月光博客
月光博客
V
V2EX
WordPress大学
WordPress大学
酷 壳 – CoolShell
酷 壳 – CoolShell
Last Week in AI
Last Week in AI
博客园 - 三生石上(FineUI控件)
小众软件
小众软件
Hugging Face - Blog
Hugging Face - Blog
V
Visual Studio Blog
宝玉的分享
宝玉的分享
雷峰网
雷峰网
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - Franky
博客园 - 聂微东
博客园 - 司徒正美
博客园 - 【当耐特】
爱范儿
爱范儿
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
大猫的无限游戏
大猫的无限游戏
博客园 - 叶小钗
阮一峰的网络日志
阮一峰的网络日志

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
StatsD, what it is and how it can help you
Olivier Pomel · 2013-08-07 · via Datadog | The Monitor blog
Olivier Pomel

Olivier Pomel

In less than 3 years since it was first introduced, StatsD has emerged as one of the most popular—and useful—parts of the modern devops toolchain. Here’s why...

What is StatsD exactly?

StatsD is originally a simple daemon developed and released by Etsy to aggregate and summarize application metrics. With StatsD, applications are to be instrumented by developers using language-specific client libraries. These libraries will then communicate with the StatsD daemon using its dead-simple protocol, and the daemon will then generate aggregate metrics and relay them to virtually any graphing or monitoring backend.

The rest, as they say, is history. StatsD quickly grew in popularity, to a point where it really became a unifying protocol for application metrics collection—of which the Etsy Daemon was only a reference implementation.

How does StatsD work?

  1. It all starts in your own application code. You—the developer—instrument it with one of the many StatsD libraries corresponding to your app language. StatsD allows you to capture different types of metrics depending on your needs: today those are Gauges, Counters, Timing Summary Statistics, and Sets. This can be as simple as adding a decorator to methods you want to time, or a one-liner to track a gauge value.

  2. The StatsD client library then sends each individual call to the StatsD server over a UDP datagram. Since UDP is a disconnected protocol in which the recipient of a datagram doesn’t send any acknowledgment to the sender, the library doesn’t need to block when submitting data as it would with TCP or HTTP-based protocols. The library also doesn’t buffer any data in-between calls which keeps it very simple. It does let you optionally sample the events to be sent to the server if you happen to instrument very high-throughput operations.

  3. The StatsD daemon will then listen to the UDP traffic from all application libraries, aggregate data over time and “flush” it at the desired interval to the backend of your choice. For example, individual function call timings may be aggregated every 10 seconds into a set of summary metrics describing its minimum, maximum, median, 90th and 95th percentile over the 10s interval. The protocol used between the StatsD Daemon and the backend will vary depending on the backend used (most are HTTP-based).

  4. The monitoring backend will turn your metrics from a stream of numbers on the wire into usable charts and alert you when needed. Examples of backends include tools like Graphite as well as yours truly.

What sets StatsD apart from the rest?

There have been and still are many alternative methods for capturing metrics, one of the most popular ones today for Java applications being the excellent Coda Hale’s Metrics library.

Here’s what sets StatsD apart today:

  • Simplicity: Not only is it very easy to instrument your app, the StatsD protocol is text-based and straightforward to write and read. The original Etsy server code was a mere 127 lines long.

  • Decoupling the application from its instrumentation: Because the daemon runs outside the app and UDP is a fire-and-forget protocol, there’s no upstream dependency between metrics collection and the app itself. StatsD can’t crash your app, and doesn’t need to be written in the same language or even run on the same machine.

  • Tiny footprint: StatsD clients are extremely thin, carry no state, need no threads and add negligible overhead.StatsD also support sampling your calls to arbitrarily reduce network utilization.

  • Ubiquity and ecosystem: There are StatsD clients for Ruby, Python, Java, Erlang, Node, Scala, Go, Haskell, and virtually every other language. Many developers wrote alternative servers to fit special needs or maximize throughput. And, there’s a plethora of backends supporting it, both open source and commercial. This means no vendor lock-in.

What problem does StatsD solve?

Beyond the technical problem it solves—getting data from point A to point B efficiently—StatsD’s biggest contributions are organizational in nature. It allows for a culture where developers don’t have to ask anyone’s permission to instrument their application, where metrics are captured before applications are deployed in production, and where abstract performance or resource utilization metrics can be directly linked to application or product metrics that are directly relevant to the business.

We often get asked how one should “implement devops”? It’s usually a long answer, but a lot of it has to do with Dev and Ops teams sharing the ownership of their application’s availability and performance, and StatsD enables just that.

StatsD & Datadog

You may have guessed by now that we’re big fans of StatsD and use it extensively internally. We also wanted to make it really easy for our customers to submit metrics from StatsD into Datadog for graphing, alerting, event correlation, and team collaboration:

  • We embedded our own StatsD daemon within the Datadog Agent, to make the setup as simple as possible while keeping it a drop-in StatsD replacement (see the source)

  • We extended the StatsD protocol to support tagging, one of Datadog’s killer features. This lets you add additional dimensions to your metrics, such as the application version, or type of customer a specific call relates to. But, we’ll come back to this in another post.

  • We made it very easy to discover StatsD metrics in the Datadog UI. Every host will automatically advertise its metrics, so you don’t have to look for them.

Want to see it in action? You can give it a spin with a free Datadog trial and follow our StatsD guide.