nrmetrics

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2015 License: MIT Imports: 5 Imported by: 2 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

nrmetrics - Apply rcrowley/go-metrics to NewRelic plugins

This package complements neocortical/newrelic

Install

go get github.com/neocortical/nrmetrics

Usage (with the newrelic package)

import (
	"time"

	"github.com/neocortical/newrelic"
	nrmetrics "github.com/neocortical/newrelic_metrics"
	metrics "github.com/rcrowley/go-metrics"
)

nr := newrelic.New("abc123")

timer := metrics.NewTimer()

plugin := &newrelic.Plugin{
	Name: "My Awesome Plugin",
	GUID: "net.neocortical.foo.bar.MyAwesomePlugin",
}

// All timer metrics turned on in this example. Only set what you want to true
metricConf := nrmetrics.MetricConfig{
	Name:        "App/Response Time",
	Unit:        "request",
	Duration:    time.Millisecond,
	Count:       true,
	Min:         true,
	Max:         true,
	Mean:        true,
	Percentiles: []float64{0.25, 0.5, 0.75, 0.9, 0.99, 0.999},
	Rate1:       true,
	Rate5:       true,
	Rate15:      true,
	RateMean:    true,
	StdDev:      true,
	Sum:         true,
	Variance:    true,
}

// Add your timer to your NewRelic plugin
nrmetrics.AddTimerMetric(plugin, timer, metricConf)
nr.AddPlugin(plugin)

// Start sending metrics data to NewRelic
nr.Run()

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCounterMetric

func AddCounterMetric(plugin *newrelic.Plugin, counter metrics.Counter, config MetricConfig)

AddCounterMetric Adds various metrics based on a Counter, according to the supplied MetricConfig

func AddGaugeMetric

func AddGaugeMetric(plugin *newrelic.Plugin, gauge metrics.Gauge, config MetricConfig)

AddGaugeMetric Adds various metrics based on a Gauge, according to the supplied MetricConfig.

func AddHistogramMetric

func AddHistogramMetric(plugin *newrelic.Plugin, histo metrics.Histogram, config MetricConfig)

AddHistogramMetric Adds various metrics based on a Histogram, according to the supplied MetricConfig

func AddMeterMetric

func AddMeterMetric(plugin *newrelic.Plugin, meter metrics.Meter, config MetricConfig)

AddMeterMetric Adds various metrics based on a Meter, according to the supplied MetricConfig

func AddTimerMetric

func AddTimerMetric(plugin *newrelic.Plugin, timer metrics.Timer, config MetricConfig)

AddTimerMetric Adds various metrics based on a Timer, according to the supplied MetricConfig

Types

type MetricConfig

type MetricConfig struct {
	Name        string
	Unit        string
	Duration    time.Duration
	Count       bool
	Value       bool
	Min         bool
	Max         bool
	Mean        bool
	Percentiles []float64
	Rate1       bool
	Rate5       bool
	Rate15      bool
	RateMean    bool
	StdDev      bool
	Sum         bool
	Variance    bool
}

MetricConfig defines the metrics that should be created for a given metric object, including the unit name and desired time precision. For example: Name: "MyApp/Response Time", // root of the metric name Unit: "request", // the thing being timed Duration: time.Millisecond, // show the histogram values in milliseconds Count: true, // Send a total count metric (requests) Min: true, // Send a min request time metric (milliseconds) Max: true, // Send a max request time metric (milliseconds) Mean: true, // Send the avg request time (milliseconds/request) Percentiles: []float64{0.25, 0.5, 0.75, 0.9, 0.99, 0.999}, // Send these percentiles (milliseconds/request) Rate1: true, // Send the 1-minute rate, always in seconds (requests/second) Rate5: true, // Send the 5-minute rate, always in seconds (requests/second) Rate15: true, // Send the 15-minute rate, always in seconds (requests/second) RateMean: true, // Send the mean rate, always in seconds (requests/second) StdDev: true, // Send the std dev (milliseconds) Sum: true, // Send the sum of all recorded times (milliseconds) Variance: true, // Send the variance (milliseconds)

Jump to

Keyboard shortcuts

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