v2.0.1+incompatible Latest Latest

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

Go to latest
Published: May 6, 2015 License: BSD-2-Clause, Apache-2.0 Imports: 9 Imported by: 0


New Relic Platform Agent SDK for Go(golang)

Build Status

This package provide very simple interface to NewRelic Platform

For example of usage see examples/wave_plugin.go

For real-word example, you can have a look at:



Package newrelic_platform_go is New Relic Platform Agent SDK for Go language.



View Source
const (


This section is empty.


This section is empty.


type Agent

type Agent struct {
	Host    string `json:"host"`
	Version string `json:"version"`
	Pid     int    `json:"pid"`

func NewAgent

func NewAgent(Version string) *Agent

func (*Agent) CollectEnvironmentInfo

func (agent *Agent) CollectEnvironmentInfo()

type AggregatedMetricaValue

type AggregatedMetricaValue struct {
	Min          float64 `json:"min"`
	Max          float64 `json:"max"`
	Total        float64 `json:"total"`
	Count        int     `json:"count"`
	SumOfSquares float64 `json:"sum_of_squares"`

func NewAggregatedMetricaValue

func NewAggregatedMetricaValue(existValue float64, newValue float64) *AggregatedMetricaValue

func (*AggregatedMetricaValue) Aggregate

func (aggregatedValue *AggregatedMetricaValue) Aggregate(newValue float64)

type ComponentData

type ComponentData interface{}

type IComponent

type IComponent interface {
	Harvest(plugin INewrelicPlugin) ComponentData
	SetDuration(duration int)
	AddMetrica(model IMetrica)

type IMetrica

type IMetrica interface {
	GetValue() (float64, error)
	GetName() string
	GetUnits() string

type INewrelicPlugin

type INewrelicPlugin interface {
	GetMetricaKey(metrica IMetrica) string
	Harvest() error
	AddComponent(component IComponent)

type MetricaValue

type MetricaValue interface{}

type NewrelicPlugin

type NewrelicPlugin struct {
	Agent      *Agent          `json:"agent"`
	Components []ComponentData `json:"components"`

	ComponentModels      []IComponent `json:"-"`
	LastPollTime         time.Time    `json:"-"`
	Verbose              bool         `json:"-"`
	LicenseKey           string       `json:"-"`
	PollIntervalInSecond int          `json:"-"`

func NewNewrelicPlugin

func NewNewrelicPlugin(version string, licenseKey string, pollInterval int) *NewrelicPlugin

func (*NewrelicPlugin) AddComponent

func (plugin *NewrelicPlugin) AddComponent(component IComponent)

func (*NewrelicPlugin) CheckResponse

func (plugin *NewrelicPlugin) CheckResponse(httpResponseCode int) (error, bool)

func (*NewrelicPlugin) ClearSentData

func (plugin *NewrelicPlugin) ClearSentData()

func (*NewrelicPlugin) GetMetricaKey

func (plugin *NewrelicPlugin) GetMetricaKey(metrica IMetrica) string

func (*NewrelicPlugin) Harvest

func (plugin *NewrelicPlugin) Harvest() error

func (*NewrelicPlugin) Run

func (plugin *NewrelicPlugin) Run()

func (*NewrelicPlugin) SendMetricas

func (plugin *NewrelicPlugin) SendMetricas() (int, error)

type PluginComponent

type PluginComponent struct {
	Name          string                  `json:"name"`
	GUID          string                  `json:"guid"`
	Duration      int                     `json:"duration"`
	Metrics       map[string]MetricaValue `json:"metrics"`
	MetricaModels []IMetrica              `json:"-"`

func NewPluginComponent

func NewPluginComponent(name string, guid string) *PluginComponent

func (*PluginComponent) AddMetrica

func (component *PluginComponent) AddMetrica(model IMetrica)

func (*PluginComponent) ClearSentData

func (component *PluginComponent) ClearSentData()

func (*PluginComponent) Harvest

func (component *PluginComponent) Harvest(plugin INewrelicPlugin) ComponentData

func (*PluginComponent) SetDuration

func (component *PluginComponent) SetDuration(duration int)

type SimpleMetricaValue

type SimpleMetricaValue float64


Path Synopsis

Jump to

Keyboard shortcuts

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