newrelic_platform_go

package module
v0.0.0-...-9c099fb Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2016 License: BSD-2-Clause Imports: 10 Imported by: 157 modules, 274 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

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:"-"`

	// The URL to use for New Relic. Can change for testing purposes. Defaults to NERELIC_API_URL
	URL string

	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:"-"`
	// contains filtered or unexported fields
}

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
⌂ 换网址