SlideShare ist ein Scribd-Unternehmen logo
1 von 34
Downloaden Sie, um offline zu lesen
StatsD workshop @
                        Monitorama 2013
                                 Daniel Schauenberg
                         Software Engineer, Etsy Infrastructure
                                      @mrtazz




Friday, March 29, 13
• What is this StatsD?
                        • Metrics types
                        • Backends
                       • Graphite and operating StatsD
                       • Send all the metrics
                       • Write all the backends

Friday, March 29, 13
Friday, March 29, 13
Metrics
                                  processing
                                   module

                       Receiver
                         loop


                                    Backends




Friday, March 29, 13
legacyNamespace: false



Friday, March 29, 13
Counters

                       foo.bar:1|c

       stats.counters.foo.bar.rate
      stats.counters.foo.bar.count

Friday, March 29, 13
Gauges

                          foo.gar:30|g
                           foo.gar:-5|g
                          foo.gar:+5|g

                       stats.gauges.foo.gar
Friday, March 29, 13
Sets

                         foo.sar:30|s
                         foo.sar:50|s

                       stats.sets.foo.sar

Friday, March 29, 13
Timers

                       foo.tar:30|ms

    stats.timers.foo.tar.mean_90
        stats.timers.foo.tar.std
     stats.timers.foo.tar.sum_90
Friday, March 29, 13
Histograms

            histogram: [{metric: "foo.tar", bins:
                     [10,20,30,50]}]

      stats.timers.foo.tar.histogram.bin_10
      stats.timers.foo.tar.histogram.bin_20
Friday, March 29, 13
Friday, March 29, 13
Pluggable backends
       function MyBackend(startupTime, config, emitter){
         var self = this;
         this.lastFlush = startupTime;
         this.lastException = startupTime;
         this.config = config.mybackendconfig || {};

         // what to do with metrics
         emitter.on('flush', function(timestamp, metrics) {});
          // update your status
         emitter.on('status', function(callback) {});
          // handle raw packet
          emitter.on('packet', function(packet, rinfo) {});
       };


Friday, March 29, 13
Management Interface
                       > telnet 127.0.0.1 8126
                       > stats
                       > counters
                       > delcounters
                       > help



Friday, March 29, 13
Graphite + StatsD

                       • default backend
                       • whisper archives should match flush
                         interval
                       • sum aggregation for raw counters
                       • docs/graphite.md

Friday, March 29, 13
The single-thread
                           dilemma




Friday, March 29, 13
Tuning UDP
            # increase default core memory sizes
            net.core.rmem_default = 16777216
            net.core.wmem_default = 16777216
            net.ipv4.udp_wmem_min = 67108864
            net.ipv4.udp_rmem_min = 67108864
            net.ipv4.udp_mem = 4648512     6198016   9297024


Friday, March 29, 13
Sampling




                       • default sampling of 0.1 on all metrics
                       • most sent keys (log file) are sampled 0.01
Friday, March 29, 13
Quis monitoret ipsos
                            monitores?


Friday, March 29, 13
Friday, March 29, 13
Friday, March 29, 13
Friday, March 29, 13
Friday, March 29, 13
Let’s do this
Friday, March 29, 13
Basic setup

                       • git clone https://github.com/etsy/statsd.git
                       • curl https://gist.github.com/mrtazz/5270376
                         > test_config.js
                       • nc -k -l 2003 > output.log
                       • node stats.js test_config.js

Friday, March 29, 13
Send some stats
             > echo -n "foo.bar:1|c" | nc -w0 -u 127.0.0.1 8125
             > echo -n "foo.lerl:3|g" | nc -w0 -u 127.0.0.1 8125
             > echo -n "foo.lol:33|ms" | nc -w0 -u 127.0.0.1 8125
             > echo -n "foo.lol:43|ms" | nc -w0 -u 127.0.0.1 8125
             > echo -n "foo.lol:53|ms" | nc -w0 -u 127.0.0.1 8125



Friday, March 29, 13
Some actual stats
           Disk space:
           df -m | grep "/var" | awk '{print "diskspace.var:"$4"|g"}'
           Apache HTTPD processes:
           echo -n "httpd.procs:$(ps aux | grep [h]ttpd | wc -l)|g"
           Logfile size:
           du -s /var/log/chef.log | awk '{print "cheflog:"$1"|g"}'



Friday, March 29, 13
Is this real life?

                       • Set up a web page
                       • Have it send stats to StatsD
                        • page load time
                        • counters when page was accessed
                       • look in the examples/ directory for code

Friday, March 29, 13
Histograms

                       • You should have timers now
                       • Configure histograms for them
                       • { graphite: { histograms: [] }


Friday, March 29, 13
Level up!




Friday, March 29, 13
Write a new backend

                       • Have it HTTP POST to a web server
                       • write metrics to a file
                       • send a txt message
                       • repeat all UDP packets to TCP

Friday, March 29, 13
Hackathon ideas

                       • Metrics path validation in backend
                       • Pluggable receiver frontends
                       • Forked backends
                       • Configurable timer metrics

Friday, March 29, 13
• #statsd on Freenode IRC
                       • statsd@librelist.com
                       • Ask me



Friday, March 29, 13
Basic setup

                       • git clone https://github.com/etsy/statsd.git
                       • curl https://gist.github.com/mrtazz/5270376
                         > test_config.js
                       • nc -k -l 2003 > output.log
                       • node stats.js test_config.js

Friday, March 29, 13
StatsD workshop @
                        Monitorama 2013
                                 Daniel Schauenberg
                         Software Engineer, Etsy Infrastructure
                                      @mrtazz




Friday, March 29, 13

Weitere ähnliche Inhalte

Ähnlich wie StatsD Workshop Monitorama 2013

Erlang Application Metrics with Folsom
Erlang Application Metrics with FolsomErlang Application Metrics with Folsom
Erlang Application Metrics with Folsom
logicalstack
 
Building scalable applications while scaling your infrastructure by rhommel l...
Building scalable applications while scaling your infrastructure by rhommel l...Building scalable applications while scaling your infrastructure by rhommel l...
Building scalable applications while scaling your infrastructure by rhommel l...
NETWAYS
 
Cook Up a Runtime with The New OSGi Resolver - Neil Bartlett
Cook Up a Runtime with The New OSGi Resolver - Neil BartlettCook Up a Runtime with The New OSGi Resolver - Neil Bartlett
Cook Up a Runtime with The New OSGi Resolver - Neil Bartlett
mfrancis
 
Tachikoma 2013-01
Tachikoma 2013-01Tachikoma 2013-01
Tachikoma 2013-01
Ryota Hanyu
 

Ähnlich wie StatsD Workshop Monitorama 2013 (20)

Erlang Application Metrics with Folsom
Erlang Application Metrics with FolsomErlang Application Metrics with Folsom
Erlang Application Metrics with Folsom
 
Chef - Configuration Management for the Cloud
Chef - Configuration Management for the CloudChef - Configuration Management for the Cloud
Chef - Configuration Management for the Cloud
 
Hotspot Garbage Collection - Tuning Guide
Hotspot Garbage Collection - Tuning GuideHotspot Garbage Collection - Tuning Guide
Hotspot Garbage Collection - Tuning Guide
 
metrics - performance monitoring or business value optimization?
metrics - performance monitoring or business value optimization?metrics - performance monitoring or business value optimization?
metrics - performance monitoring or business value optimization?
 
Graph-Tool in Practice
Graph-Tool in PracticeGraph-Tool in Practice
Graph-Tool in Practice
 
Smarter Scheduling
Smarter SchedulingSmarter Scheduling
Smarter Scheduling
 
What’s new in 9.6, by PostgreSQL contributor
What’s new in 9.6, by PostgreSQL contributorWhat’s new in 9.6, by PostgreSQL contributor
What’s new in 9.6, by PostgreSQL contributor
 
Building scalable applications while scaling your infrastructure by rhommel l...
Building scalable applications while scaling your infrastructure by rhommel l...Building scalable applications while scaling your infrastructure by rhommel l...
Building scalable applications while scaling your infrastructure by rhommel l...
 
openTSDB - Metrics for a distributed world
openTSDB - Metrics for a distributed worldopenTSDB - Metrics for a distributed world
openTSDB - Metrics for a distributed world
 
Cook Up a Runtime with The New OSGi Resolver - Neil Bartlett
Cook Up a Runtime with The New OSGi Resolver - Neil BartlettCook Up a Runtime with The New OSGi Resolver - Neil Bartlett
Cook Up a Runtime with The New OSGi Resolver - Neil Bartlett
 
Building scalable applications while scaling your infrastructure by rhommel l...
Building scalable applications while scaling your infrastructure by rhommel l...Building scalable applications while scaling your infrastructure by rhommel l...
Building scalable applications while scaling your infrastructure by rhommel l...
 
Fluentdでログ収集「だけ」やる話 #study2study
Fluentdでログ収集「だけ」やる話 #study2studyFluentdでログ収集「だけ」やる話 #study2study
Fluentdでログ収集「だけ」やる話 #study2study
 
Tachikoma 2013-01
Tachikoma 2013-01Tachikoma 2013-01
Tachikoma 2013-01
 
Data Analytics and Simulation in Parallel with MATLAB*
Data Analytics and Simulation in Parallel with MATLAB*Data Analytics and Simulation in Parallel with MATLAB*
Data Analytics and Simulation in Parallel with MATLAB*
 
Oracle to Postgres Migration - part 2
Oracle to Postgres Migration - part 2Oracle to Postgres Migration - part 2
Oracle to Postgres Migration - part 2
 
Around the world with extensions | PostgreSQL Conference Europe 2018 | Craig ...
Around the world with extensions | PostgreSQL Conference Europe 2018 | Craig ...Around the world with extensions | PostgreSQL Conference Europe 2018 | Craig ...
Around the world with extensions | PostgreSQL Conference Europe 2018 | Craig ...
 
Js memory
Js memoryJs memory
Js memory
 
Real World Storage in Treasure Data
Real World Storage in Treasure DataReal World Storage in Treasure Data
Real World Storage in Treasure Data
 
Application Logging With The ELK Stack
Application Logging With The ELK StackApplication Logging With The ELK Stack
Application Logging With The ELK Stack
 
A Workshop on R
A Workshop on RA Workshop on R
A Workshop on R
 

Mehr von Daniel Schauenberg

Development, Deployment & Collaboration at Etsy
Development, Deployment & Collaboration at EtsyDevelopment, Deployment & Collaboration at Etsy
Development, Deployment & Collaboration at Etsy
Daniel Schauenberg
 

Mehr von Daniel Schauenberg (12)

Human Factors and PostMortems
Human Factors and PostMortemsHuman Factors and PostMortems
Human Factors and PostMortems
 
Deploy, Collaborate and Listen
Deploy, Collaborate and ListenDeploy, Collaborate and Listen
Deploy, Collaborate and Listen
 
Data Driven Monitoring
Data Driven MonitoringData Driven Monitoring
Data Driven Monitoring
 
Development, Deployment & Collaboration at Etsy
Development, Deployment & Collaboration at EtsyDevelopment, Deployment & Collaboration at Etsy
Development, Deployment & Collaboration at Etsy
 
Mobile CI at Etsy
Mobile CI at EtsyMobile CI at Etsy
Mobile CI at Etsy
 
A Whirlwind Tour of Etsy's Monitoring Stack
A Whirlwind Tour of Etsy's Monitoring StackA Whirlwind Tour of Etsy's Monitoring Stack
A Whirlwind Tour of Etsy's Monitoring Stack
 
Development, Deployment and Collaboration at Etsy
Development, Deployment and Collaboration at EtsyDevelopment, Deployment and Collaboration at Etsy
Development, Deployment and Collaboration at Etsy
 
Scaling Deployment at Etsy
Scaling Deployment at EtsyScaling Deployment at Etsy
Scaling Deployment at Etsy
 
Feature Flagging your Infrastructure for Fun and Profit
Feature Flagging your Infrastructure for Fun and ProfitFeature Flagging your Infrastructure for Fun and Profit
Feature Flagging your Infrastructure for Fun and Profit
 
DevTools at Etsy
DevTools at EtsyDevTools at Etsy
DevTools at Etsy
 
Scaling Deployment at Etsy
Scaling Deployment at EtsyScaling Deployment at Etsy
Scaling Deployment at Etsy
 
Etsy chef-workflow
Etsy chef-workflowEtsy chef-workflow
Etsy chef-workflow
 

Kürzlich hochgeladen

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Kürzlich hochgeladen (20)

[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 

StatsD Workshop Monitorama 2013

  • 1. StatsD workshop @ Monitorama 2013 Daniel Schauenberg Software Engineer, Etsy Infrastructure @mrtazz Friday, March 29, 13
  • 2. • What is this StatsD? • Metrics types • Backends • Graphite and operating StatsD • Send all the metrics • Write all the backends Friday, March 29, 13
  • 4. Metrics processing module Receiver loop Backends Friday, March 29, 13
  • 6. Counters foo.bar:1|c stats.counters.foo.bar.rate stats.counters.foo.bar.count Friday, March 29, 13
  • 7. Gauges foo.gar:30|g foo.gar:-5|g foo.gar:+5|g stats.gauges.foo.gar Friday, March 29, 13
  • 8. Sets foo.sar:30|s foo.sar:50|s stats.sets.foo.sar Friday, March 29, 13
  • 9. Timers foo.tar:30|ms stats.timers.foo.tar.mean_90 stats.timers.foo.tar.std stats.timers.foo.tar.sum_90 Friday, March 29, 13
  • 10. Histograms histogram: [{metric: "foo.tar", bins: [10,20,30,50]}] stats.timers.foo.tar.histogram.bin_10 stats.timers.foo.tar.histogram.bin_20 Friday, March 29, 13
  • 12. Pluggable backends function MyBackend(startupTime, config, emitter){   var self = this;   this.lastFlush = startupTime;   this.lastException = startupTime;   this.config = config.mybackendconfig || {};   // what to do with metrics   emitter.on('flush', function(timestamp, metrics) {}); // update your status   emitter.on('status', function(callback) {}); // handle raw packet emitter.on('packet', function(packet, rinfo) {}); }; Friday, March 29, 13
  • 13. Management Interface > telnet 127.0.0.1 8126 > stats > counters > delcounters > help Friday, March 29, 13
  • 14. Graphite + StatsD • default backend • whisper archives should match flush interval • sum aggregation for raw counters • docs/graphite.md Friday, March 29, 13
  • 15. The single-thread dilemma Friday, March 29, 13
  • 16. Tuning UDP # increase default core memory sizes net.core.rmem_default = 16777216 net.core.wmem_default = 16777216 net.ipv4.udp_wmem_min = 67108864 net.ipv4.udp_rmem_min = 67108864 net.ipv4.udp_mem = 4648512 6198016 9297024 Friday, March 29, 13
  • 17. Sampling • default sampling of 0.1 on all metrics • most sent keys (log file) are sampled 0.01 Friday, March 29, 13
  • 18. Quis monitoret ipsos monitores? Friday, March 29, 13
  • 23. Let’s do this Friday, March 29, 13
  • 24. Basic setup • git clone https://github.com/etsy/statsd.git • curl https://gist.github.com/mrtazz/5270376 > test_config.js • nc -k -l 2003 > output.log • node stats.js test_config.js Friday, March 29, 13
  • 25. Send some stats > echo -n "foo.bar:1|c" | nc -w0 -u 127.0.0.1 8125 > echo -n "foo.lerl:3|g" | nc -w0 -u 127.0.0.1 8125 > echo -n "foo.lol:33|ms" | nc -w0 -u 127.0.0.1 8125 > echo -n "foo.lol:43|ms" | nc -w0 -u 127.0.0.1 8125 > echo -n "foo.lol:53|ms" | nc -w0 -u 127.0.0.1 8125 Friday, March 29, 13
  • 26. Some actual stats Disk space: df -m | grep "/var" | awk '{print "diskspace.var:"$4"|g"}' Apache HTTPD processes: echo -n "httpd.procs:$(ps aux | grep [h]ttpd | wc -l)|g" Logfile size: du -s /var/log/chef.log | awk '{print "cheflog:"$1"|g"}' Friday, March 29, 13
  • 27. Is this real life? • Set up a web page • Have it send stats to StatsD • page load time • counters when page was accessed • look in the examples/ directory for code Friday, March 29, 13
  • 28. Histograms • You should have timers now • Configure histograms for them • { graphite: { histograms: [] } Friday, March 29, 13
  • 30. Write a new backend • Have it HTTP POST to a web server • write metrics to a file • send a txt message • repeat all UDP packets to TCP Friday, March 29, 13
  • 31. Hackathon ideas • Metrics path validation in backend • Pluggable receiver frontends • Forked backends • Configurable timer metrics Friday, March 29, 13
  • 32. • #statsd on Freenode IRC • statsd@librelist.com • Ask me Friday, March 29, 13
  • 33. Basic setup • git clone https://github.com/etsy/statsd.git • curl https://gist.github.com/mrtazz/5270376 > test_config.js • nc -k -l 2003 > output.log • node stats.js test_config.js Friday, March 29, 13
  • 34. StatsD workshop @ Monitorama 2013 Daniel Schauenberg Software Engineer, Etsy Infrastructure @mrtazz Friday, March 29, 13