Skip to content

Commit

Permalink
statsd.cr, v0.1.0
Browse files Browse the repository at this point in the history
- Create a CHANGELOG.md file
- Add benchmark.cr to examples
- Update README.md
- Update Makefile for current targets
  • Loading branch information
miketheman committed Apr 2, 2016
1 parent 135effc commit 8074237
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 18 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Change Log

All notable changes to this project will be documented in this file.
This project aims to adhere to [Semantic Versioning](http://semver.org/).

# 0.1.0 / 2016-04-01

- Initial release, supporting all statsd spec & extended spec for histograms and tags.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2015 Mike Fiedler
Copyright (c) 2015,2016 Mike Fiedler

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
15 changes: 9 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
.PHONY: all build clean format spec release
.PHONY: all benchmark clean docs format spec release

all: build
all: spec

build:
crystal build --stats -o bin/statsd src/statsd.cr
benchmark: clean
crystal run --release examples/benchmark.cr

clean:
rm -fr .crystal/ bin/statsd
rm -fr .crystal/ doc/ bin/*

docs:
crystal docs

format:
crystal tool format
Expand All @@ -15,4 +18,4 @@ spec:
crystal spec

release: clean
crystal build --stats -o bin/statsd --release src/statsd.cr
# TODO: shards release
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,30 @@ dependencies:
## Usage
```crystal
require "statsd"

statsd = Statsd::Client.new
statsd.increment "myapp.login_page", 1
```


TODO: Write usage instructions here
# Datadog-compliant statsd tags:
statsd.increment "page.views", tags: ["page:login", "app:myapp"]
```
## Development
See `examples/test.cr` for more.

TODO: Write development instructions here

## Contributing

1. Fork it ( https://github.com/[your-github-name]/statsd/fork )
2. Create your feature branch (git checkout -b my-new-feature)
3. Commit your changes (git commit -am 'Add some feature')
4. Push to the branch (git push origin my-new-feature)
5. Create a new Pull Request
3. Test your changes with `make spec`
4. Commit your changes (git commit -am 'Add some feature')
5. Push to the branch (git push origin my-new-feature)
6. Create a new Pull Request


## Contributors
Leans heavily on [syslog.cr](https://github.com/comandeo/syslog.cr) and [statsd](https://github.com/reinh/statsd) for inspiration.
Inspired by [syslog.cr](https://github.com/comandeo/syslog.cr) and [statsd](https://github.com/reinh/statsd).

- [miketheman](https://github.com/miketheman) Mike Fiedler - creator, maintainer
- [@miketheman](https://github.com/miketheman) Mike Fiedler - creator, maintainer
Empty file added bin/.gitkeep
Empty file.
14 changes: 14 additions & 0 deletions examples/benchmark.cr
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
require "benchmark"
require "../src/statsd.cr"

Benchmark.ips do |x|
statsd = Statsd::Client.new

x.report("increments") { statsd.increment "page.views" }
x.report("increments w/tags") { statsd.increment "page.views", tags: ["foo:bar"] }
x.report("decrements") { statsd.decrement "page.views" }
x.report("gauges") { statsd.gauge("users.current", 5) }
x.report("gauges w/tags") { statsd.gauge("users.current", 5, tags: ["foo:bar"]) }
x.report("timing") { statsd.timing("db.query", 100) }
x.report("time") { statsd.time("timed.block") { true } }
end

0 comments on commit 8074237

Please sign in to comment.