Skip to content

Instantly share code, notes, and snippets.

@grierj
Created August 13, 2011 02:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grierj/1143410 to your computer and use it in GitHub Desktop.
Save grierj/1143410 to your computer and use it in GitHub Desktop.
A simple parser
import avro.io
import avro.datafile
class Parser:
def __init__(self):
self.datum_reader = avro.io.DatumReader()
def parse(self, message):
reader = avro.datafile.DataFileReader(message, self.datum_reader)
for record in reader:
host = record['host']
for metric in record['metriclist']:
yield { time: metric['time'],
host: host,
metric_name: metric['metric'],
value: metric['value'],
ds_type: metric['metric_type'], }
@brikis98
Copy link

See "Autometrics: Self-service metrics collection" for more information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment