Go client library for Riemann.
This client library was inspired by Raidman, and Riemann NodeJS Client.
Features:
- Idiomatic concurrency
- Sending events, state updates, queries.
- Feature parity with the reference implementation written in Ruby.
To install the package for use in your own programs:
go get github.com/bigdatadev/goryman
If you're a developer, Riemann uses Google Protocol Buffers, so make sure that's installed and available on your PATH.
go get github.com/golang/protobuf/{proto,protoc-gen-go}
First we'll need to import the library:
import (
"github.com/bigdatadev/goryman"
)
Next we'll need to establish a new client:
c := goryman.NewGorymanClient("localhost:5555")
err := c.Connect()
if err != nil {
panic(err)
}
Don't forget to close the client connection when you're done:
defer c.Close()
Just like the Riemann Ruby client, the client sends small events over UDP by default. TCP is used for queries, and large events. There is no acknowledgement of UDP packets, but they are roughly an order of magnitude faster than TCP. We assume both TCP and UDP are listening on the same port.
Sending events is easy (list of valid event properties):
err = c.SendEvent(&goryman.Event{
Service: "moargore",
Metric: 100,
Tags: []string{"nonblocking"},
})
if err != nil {
panic(err)
}
You can also query events:
events, err := c.QueryEvents("host = \"goryman\"")
if err != nil {
panic(err)
}
The Hostname and Time in events will automatically be replaced with the hostname of the server and the current time if none is specified.
Martini: GoryMartini
Just send me a pull request. Please take a look at the project issues and see how you can help. Here are some tips:
- please add more tests.
- please check your syntax.
Christopher Gilbert
- Web: http://cjgilbert.me
- Twitter: @bigdatadev
- Linkedin: /in/christophergilbert
See LICENSE document