package newrelic_platform_go
import "github.com/yvasiyarov/newrelic_platform_go"
Package newrelic_platform_go is New Relic Platform Agent SDK for Go language.
Index ¶
- Constants
- type Agent
- type AggregatedMetricaValue
- func NewAggregatedMetricaValue(existValue float64, newValue float64) *AggregatedMetricaValue
- func (aggregatedValue *AggregatedMetricaValue) Aggregate(newValue float64)
- type ComponentData
- type IComponent
- type IMetrica
- type INewrelicPlugin
- type MetricaValue
- type NewrelicPlugin
- func NewNewrelicPlugin(version string, licenseKey string, pollInterval int) *NewrelicPlugin
- func (plugin *NewrelicPlugin) AddComponent(component IComponent)
- func (plugin *NewrelicPlugin) CheckResponse(httpResponseCode int) (error, bool)
- func (plugin *NewrelicPlugin) ClearSentData()
- func (plugin *NewrelicPlugin) GetMetricaKey(metrica IMetrica) string
- func (plugin *NewrelicPlugin) Harvest() error
- func (plugin *NewrelicPlugin) Run()
- func (plugin *NewrelicPlugin) SendMetricas() (int, error)
- type PluginComponent
- func NewPluginComponent(name string, guid string, verbose bool) *PluginComponent
- func (component *PluginComponent) AddMetrica(model IMetrica)
- func (component *PluginComponent) ClearSentData()
- func (component *PluginComponent) Harvest(plugin INewrelicPlugin) ComponentData
- func (component *PluginComponent) SetDuration(duration int)
- type SimpleMetricaValue
Constants ¶
const (
NEWRELIC_API_URL = "https://platform-api.newrelic.com/platform/v1/metrics"
)
Types ¶
type Agent ¶
type Agent struct {
Host string `json:"host"`
Version string `json:"version"`
Pid int `json:"pid"`
}
func NewAgent ¶
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 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
Source Files ¶
agent.go component.go doc.go metrica.go plugin.go
Directories ¶
| Path | Synopsis |
|---|---|
| examples |
- Version
- v0.0.0-20160601141957-9c099fbc30e9 (latest)
- Published
- Jun 1, 2016
- Platform
- linux/amd64
- Imports
- 10 packages
- Last checked
- 10 months ago –
Tools for package owners.