honeycomb

package module
v0.0.0-...-12071f1 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

README

go-metrics-honeycomb

This is a simple reporter for rcrowley's go-metrics library, designed to work with the Honeycomb metrics reporting service.

For more information, check out the GoDoc.

Usage

Basic usage:


import (
  "time"

  "github.com/getspine/go-metrics-honeycomb"
  "github.com/rcrowley/go-metrics"
)

go honeycomb.Honeycomb(
  metrics.DefaultRegistry,
  60 * time.Second,      // Interval between sending metrics
  "your-write-key",      // Honeycomb write key
  "your-dataset",        // Honeycomb dataset
  []float64{0.95, 0.99}, // Percentiles to report from histograms
)

If you wish to add extra fields or other configuration to the Honeycomb client, you can use the following procedure:

import (
  "time"

  "github.com/getspine/go-metrics-honeycomb"
  "github.com/honeycombio/libhoney-go"
  "github.com/rcrowley/go-metrics"
)

reporter := honeycomb.NewReporter(
  metrics.DefaultRegistry,
  60 * time.Second,      // Interval between sending metrics
  "your-write-key",      // Honeycomb write key
  "your-dataset",        // Honeycomb dataset,
  []float64{0.95, 0.99}, // Percentiles to report from histograms
)

libhoney.AddField("philcollins", "sussudio")
...

go reporter.Run()

Installation

$ go get github.com/getspine/go-metrics-honeycomb

Bugs

If you run into any bugs, please drop an issue on our GitHub and we'll be sure to have a look.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Honeycomb

func Honeycomb(
	registry metrics.Registry,
	interval time.Duration,
	writeKey string,
	dataset string,
	serviceName string,
	source string,
	percentiles []float64,
	resetCounters bool,
)

Types

type Reporter

type Reporter struct {
	Registry      metrics.Registry
	Interval      time.Duration
	WriteKey      string
	Dataset       string
	ServiceName   string
	Source        string
	Percentiles   []float64 // percentiles to report on histogram metrics
	ResetCounters bool
	// contains filtered or unexported fields
}

func NewDefaultReporter

func NewDefaultReporter(
	registry metrics.Registry,
	writeKey string,
	dataset string,
	serviceName string,
	source string,
	resetCounters bool,
) *Reporter

func NewReporter

func NewReporter(
	registry metrics.Registry,
	interval time.Duration,
	writeKey string,
	dataset string,
	serviceName string,
	source string,
	percentiles []float64,
	resetCounters bool,
) *Reporter

func (*Reporter) AddField

func (r *Reporter) AddField(key string, val interface{})

Convenience method around libhoney.AddField()

func (*Reporter) BuildEvent

func (r *Reporter) BuildEvent() *libhoney.Event

func (*Reporter) Init

func (r *Reporter) Init()

Initializes the Honeycomb client.

func (*Reporter) Run

func (r *Reporter) Run()

Blocks and starts reporting metrics from the provided registry to Honeycomb.

func (*Reporter) Stop

func (r *Reporter) Stop()

Stops the metrics reporting process and closes any connections to Honeycomb.

Jump to

Keyboard shortcuts

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