gonr

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: 11 Imported by: 1

README

GoNR: Go NewRelic plugin client

GoNR is a customizable NewRelic plugin written in Go. It allows you to get insight into your Go app from the NewRelic dashboard.

This project (and its underlying libraries) was aided and inpired by yvasiyarov's GoRelic plugin. I chose to rewrite GoRelic with a few ideas for improvement in mind:

  • Easy, intuitive customizability
  • Code clarity/package composability
  • Unit testing
  • Finer-grained control over metrics

Installation

go get github.com/neocortical/gonr

Use

Default (Use the plugin dashboard I've set up)
import "github.com/neocortical/gonr"

func main() {
  gonrAgent := gonr.New(gonr.DefaultConfig().WithLicense("abc123"))
  gonrAgent.Run()
}

Custom (Create your own plugin dashboard and/or add your own custom metrics)
import "github.com/neocortical/gonr"

func main() {
  gonrAgent := gonr.New(gonr.Config{
		Name:    "My App",
		GUID:    "com.example.myapp.mynrplugin",
		License: "abc123",
	})
	
	gonrAgent.GetPlugin().AddMetric(myAwesomeMetric)
	
	gonrAgent.Run()
}

See my newrelic plugin library for info on how to easily create custom metrics.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Name           string
	GUID           string
	License        string
	ExcludeRuntime bool
	ExcludeMemory  bool
	ExcludeGC      bool
}

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns the default GoNR config (all components, default Name and GUID)

func (Config) WithLicense

func (c Config) WithLicense(license string) Config

WithLicense applies an API license key to a config. Ex: DefaultConfig().WithLicense("abc123")

type GonrAgent

type GonrAgent interface {
	Run()
	Client() *newrelic.Client
	Plugin() *newrelic.Plugin
}

func New

func New(config Config) GonrAgent

New creates a GoNR NewRelic client with the supplied license key

Jump to

Keyboard shortcuts

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