https://github.com/rossta/fnord-client
A client for sending events to an FnordMetric server over UDP (or TCP)
https://github.com/rossta/fnord-client
Last synced: about 1 year ago
JSON representation
A client for sending events to an FnordMetric server over UDP (or TCP)
- Host: GitHub
- URL: https://github.com/rossta/fnord-client
- Owner: rossta
- License: mit
- Created: 2012-04-23T03:03:48.000Z (about 14 years ago)
- Default Branch: master
- Last Pushed: 2012-05-07T03:50:12.000Z (about 14 years ago)
- Last Synced: 2025-02-15T10:57:01.857Z (about 1 year ago)
- Language: Ruby
- Size: 113 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Fnord::Client
Send events to an [FnordMetric](https://github.com/paulasmuth/fnordmetric) server via UDP (or TCP).
[](http://travis-ci.org/rossta/fnord-client)
## Installation
Add this line to your application's Gemfile:
gem 'fnord-client'
And then execute:
$ bundle
Or install it yourself as:
$ gem install fnord-client
## Usage
```ruby
# Connect to FnordMetric inbound stream over UDP (default)
$fnord = Fnord::Client('localhost', 1337)
# Connect to FnordMetric inbound stream over TCP
$fnord = Fnord::Client('localhost', 1337, :protocol => :tcp)
# send JSON-encoded event
$fnord.event("message_received", :user_id => 123)
# "{\"_type\":\"message_received\",\"user_id\":\"123\"}"
# set a default namespace
Fnord::Client.namespace = "staging"
$fnord.event("message_received")
# "{\"_type\":\"message_received\",\"_namespace\":\"staging\"}"
# on the server-side, configure FnordMetric to listen over UDP
FnordMetric.server_configuration = {
:inbound_protocol => :udp,
:inbound_stream => ['0.0.0.0', '1337']
# other options omitted
}
```
## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Added some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request