Upload
kunal-kerkar
View
646
Download
2
Embed Size (px)
DESCRIPTION
Citation preview
Graph Everything
Kunal Kerkar
@tsudot
We enable Phone Calls and SMS Apps to be built with a few lines of code.
a = {‘from’: ‘555-1234’, # calling party, ‘to’ : ‘919611111111, # called party, ’answer_url‘ : ‘http://example.com/answer’}
plivo.make_call(a)
Points to be discussed
1. Data at Plivo2. Graphite3. Carbon Daemons4. Configuring Carbon5. Whisper Database6. The render URL API, Graphene
Components
Tank
zgrep ‘inbound calls’ 20120823-‐plivo.tar.gz | wc -‐l
•Track calls/SMS made every hour•Number of recharges, sign ups•Endpoints registered•WebRTC vs Softphones•Server metrics
What we wanted to do?
Graphite
• Enterprise-‐scale monitoring tool• Written by Chris Davis at Orbitz in 2006 • Opensourced in 2008
Graphite
1.Store numeric time-‐series data2.Render graphs of this data on demand
What does it do?
1.carbon -‐ a Twisted daemon that listens for time-‐series data
2.whisper -‐ a simple database library for storing time-‐series data
3.graphite webapp -‐ A django webapp that renders graphs on-‐demand using cairo
Architecture : in a nutshell
• 1 daemon, carbon-‐cache.py • Listen for time-‐series data • Use a common set of protocols
Carbon Daemons
• Accepts metrics • Writes them to disk
carbon.confport (2003/2004/7002) protocols (newline delimited, pickle)transports (TCP/UDP)
storage-‐schemas.confDefines a retention policy for incoming metrics based on regex patterns.
carbon-cache.py
•A name, specified inside square brackets•A regex, specified after “pattern=”•A retention rate line, specified after “retentions=”
storage-schemas.conf
[plivoOutboundCalls]pattern=plivoOutboundCalls$retentions=10s:14d
[plivoOutboundCalls]pattern=plivoOutboundCalls$retentions=10s:14d
• [plivo_outbound_calls] is the name of this rule
• Will match any metric that ends with plivoOutboundCalls. plivo.server.proxy.p1.plivoOutboundCallsplivo.server.proxy.p1.plivoOutboundCalls.tsudot
• The retention line says that each datapoint represents 10 seconds, and we want to keep enough datapoints so that they add up to 14 days of data.
example
Helps is achieving• replication• sharding
Relay Methods • rules• consistent-‐hashing
carbon-relay.py
• Plaintext• Pickle• AMQP
Feeding in your data
<metric path> <metric value> <metric timestamp>
PORT=2003SERVER=gr.plivo.comecho "plivo.OutboundCalls 4 `date +%s`" | nc ${SERVER} ${PORT};
plaintext protocol
•Efficient than the plaintext protocol•Supports sending batches of metrics
payload = pickle.dumps(listOfMetricTuples)header = struct.pack("!L", len(payload))message = header + payload
pickle protocol
•Fixed sized database•Fast, reliable storage of numeric data•Long term retention
Whisper
•Collapse multiple data points•Uses avg by default•Other methods -‐ sum,last,max,min
Whisper : aggregation
•Each datapoint is stored with timestamp•Archives overlap time periods•All time-‐slots take up space
Whisper : efficiency
Graphite at Plivopip install graphite-web
/render?
from=-24hours
&until=now
&target=api1.process_gunicorn._cpu_
&target=api2.process_gunicorn._cpu_
The Render URL API
The Render URL API cpu usage metrics
The Render URL API “json output anyone?”
/render?
from=-24hours
&until=now
&target=django.users._registered_
&target=django.users._webrtc_
&format=json
Graphenedescription = { "Total Notifications": { source: "http://localhost:4567/", GaugeLabel: { parent: "#hero-‐one", title: "Notifications Served", type: "max" } }, "Poll Time": { source: "http://localhost:4567/", GaugeGadget: { parent: "#hero-‐one", title: "P1" } }, "<just an informative label>": { source: "<graphite graph url, add &format=json to querystring>", "<widget type>": { parent: "<which will be placed in this element>", title: "<title>" // ... many other view opts ... } }}
Summary
Thanks!