riemann

package module
v0.0.0-...-ea5aad1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 18, 2016 License: BSD-2-Clause-Views Imports: 8 Imported by: 2

README

go-metrics Riemann Reporter

Library to report metrics collected with go-metrics to Riemann.

Example

Inside your application you can use the riemann.Report function to repeatedly report metrics. This will maintain a connection to Riemann (reconnecting in the event of a connection error) and report with the specified duration.

For example:

package main

import (
	"github.com/pingles/go-metrics-riemann"
	"github.com/rcrowley/go-metrics"
	"log"
	"net"
	"time"
)

func main() {
    counter := metrics.NewCounter()
    metrics.Register("some counter", counter)
    
    go riemann.Report(metrics.DefaultRegistry, time.Second, "localhost:5555")
}

Alternatively, if you want to control the Riemann connection and when metrics are reported you can use riemann.ReportOnce and riemann.RiemannConnect in something like this:

package main

import (
	"github.com/pingles/go-metrics-riemann"
	"github.com/rcrowley/go-metrics"
	"log"
	"net"
	"time"
)

func main() {
    counter := metrics.NewCounter()
    metrics.Register("some counter", counter)
    
    // RiemannConnect will block until it successfully connects
    client := riemann.RiemannConnect("localhost:5555")

    // ReportOnce will send all metrics once to a connected client. It
    // will return an error if there is an error whilst it sends the
    // metrics to Riemann.
    err := riemann.ReportOnce(metrics.DefaultRegistry, client)
    if err != nil {
        fmt.Println("Error reporting metrics to Riemann, connection error?")
    }
}

License

Released under a BSD license. Please see LICENSE for more details.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Report

func Report(r metrics.Registry, d time.Duration, riemannHost string)

Opens a connection to Riemann and repeatedly sends events for all metrics

func ReportOnce

func ReportOnce(r metrics.Registry, c *raidman.Client) error

Send all reported metrics to connected Riemann client

func RiemannConnect

func RiemannConnect(host string) *raidman.Client

Establishes a Riemann connection, will block (and retry) until it can successfully establish a connection.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL