Skip to content

Instantly share code, notes, and snippets.

@clofresh
Created October 19, 2011 16:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clofresh/1298904 to your computer and use it in GitHub Desktop.
Save clofresh/1298904 to your computer and use it in GitHub Desktop.
Sample metrics objects
metrics = MetricFamily('my_app')
results = do_work()
metrics.record('result.created', len(results)) # my_app.result.created
for result in results:
result.save()
# my_app.result.saved. Each time increment is called, either increment the value at that timestamp (truncated
# to the second) or create a new point and increment that value.
metrics.increment('result.saved')
metrics.submit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment