Skip to content

Instantly share code, notes, and snippets.

@mm53bar
mm53bar / Gemfile
Created January 30, 2013 15:37
Be sure to install the datadog agent on your server before applying this code to your app. Instructions are at https://app.datadoghq.com/account/settings#agent or use my Sunzi recipe at https://github.com/Shift81/sunzi-recipes/blob/master/ubuntu/precise/datadog.sh
gem 'dogstatsd-ruby'
@alq666
alq666 / support_ctf.rb
Last active December 10, 2015 18:58
A simple coding test for the Support Engineer position at http://jobs.datadoghq.com
require 'rubygems'
require 'dogapi'
# Create a simple client
# You typically want to do:
# Dogapi::Client.new(your_actual_api_key_as_a_string, ...)
dog = Dogapi::Client.new(YOUR_API_KEY_HERE)
# Emit a list of points in one go as a list of (timestamp, value)
# here we pretend to send a point a minute for the past hour
@alq666
alq666 / by_day.R
Created December 10, 2012 22:30
Alerting Trends
alerts_by_day <- read.csv(‘by_day.csv’)
ggplot(alerts_by_day, aes(day_of_year, daily, color=factor(notifying))) + geom_line()
+ xlab("Day of year")
+ ylab("Service Alerts")
+ ggtitle("Notifying v. silent alerts per day")
+ geom_smooth()
occurrence_doy notifying daily
1 1 12
1 0 426
2 0 1158
2 1 2
3 0 630
3 1 48
4 0 1398
4 1 76
5 1 8
@alq666
alq666 / dogapi.sh
Created August 29, 2012 22:39
Deploy the dog cli in your home directory
#!/bin/bash -e
# Check python 2.6 or greater
python -V 2>&1 | awk '$2 !~ /^2.[67]|^3/ {exit 1}'
# Download virtualenv
curl https://raw.github.com/pypa/virtualenv/master/virtualenv.py > virtualenv.py
python virtualenv.py $HOME/datadog
source $HOME/datadog/bin/activate
# Install dogapi
pip install dogapi
# Set up the dog alias
@alq666
alq666 / gist:3174101
Created July 25, 2012 02:50
Datadog functions

A short introduction to Datadog functions

You can apply functions to metric queries in the graph editor, as long as you use the JSON editor.

The general format is:

function(metric{scope} [by {filter}])

In case of binary operators (+, -, /, *), the format is:

@mlambie
mlambie / apache_extended_status
Created July 11, 2012 03:26
Extended output
root@arcee:/var/log# curl http://localhost/server-status?auto
BusyWorkers: 1
IdleWorkers: 9
Scoreboard: _W.________.....................................................................................................................................................................................................................................................
VS.
mlambie@blitzwing:~$ curl http://localhost/server-status?auto
Total Accesses: 557
Total kBytes: 17924
@bcambel
bcambel / gist:2844136
Created May 31, 2012 15:24
DDAGENTSRV_LOG
2012-05-31 15:17:40,719 - root - INFO - Logging to /tmp/dd-agent.log
2012-05-31 15:17:40,719 - root - WARNING - Pid file: /tmp/dd-agent.pid
2012-05-31 15:17:40,719 - root - INFO - Running in foreground
2012-05-31 15:17:40,719 - agent - DEBUG - Collecting basic system stats
2012-05-31 15:17:40,738 - agent - DEBUG - System: {'nixV': ('Ubuntu', '10.04', 'lucid'), 'cpuCores': 2, 'machine': 'x86_64', 'platform': 'linux2', 'pythonV': '2.6.5', 'processor': ''}
2012-05-31 15:17:40,738 - agent - DEBUG - Creating checks instance
2012-05-31 15:17:40,785 - agent - INFO - Running on EC2, instanceId: i-fdf2929e
2012-05-31 15:17:40,786 - checks - INFO - Dogstream parsers: []
2012-05-31 15:17:40,788 - checks - INFO - Starting checks
2012-05-31 15:17:40,788 - checks - DEBUG - SIZE: <function getApacheStatus at 0x2ca5a28> wrote 5 bytes uncompressed
@jboner
jboner / latency.txt
Last active May 3, 2024 15:17
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@alq666
alq666 / cloudwatch.awk
Created March 5, 2012 20:52
aws crawler stats
BEGIN {
skipped = 0;
processed = 0;
}
/Skipped/ {
skipped++;
}
/Saving/ {