newrelic_platform_go

package
v0.0.140 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2015 License: BSD-2-Clause, GPL-2.0 Imports: 9 Imported by: 0

README

New Relic Platform Agent SDK for Go(golang)

Build Status

This package provide very simple interface to NewRelic Platform http://newrelic.com/platform

For example of usage see examples/wave_plugin.go

For real-word example, you can have a look at:
https://github.com/yvasiyarov/newrelic_sphinx

Documentation

Overview

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

Index

Constants

View Source
const (
	NEWRELIC_API_URL = "https://platform-api.newrelic.com/platform/v1/metrics"
)

Variables

This section is empty.

Functions

This section is empty.

Types

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)
	ClearSentData()
}

type IMetrica

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

type INewrelicPlugin

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

type MetricaValue

type MetricaValue interface{}

type NewrelicPlugin

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

	// All HTTP requests will be done using this client. Change it if you need
	// to use a proxy.
	Client http.Client `json:"-"`

	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:"-"`
	Verbose       bool                    `json:"-"`
}

func NewPluginComponent

func NewPluginComponent(name string, guid string, verbose bool) *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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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