Skip to content

pingles/go-metrics-riemann

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

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.

About

Report go-metrics data to Riemann

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages