newrelic

package
v0.0.0-...-7a0dfb2 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2020 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BackendName is the name of this backend.
	BackendName = "newrelic"
)

Variables

This section is empty.

Functions

func NewClientFromViper

func NewClientFromViper(v *viper.Viper, logger logrus.FieldLogger, pool *transport.TransportPool) (gostatsd.Backend, error)

NewClientFromViper returns a new New Relic client.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client represents a New Relic client.

func NewClient

func NewClient(transport, address, addressMetrics, eventType, flushType, apiKey, tagPrefix,
	metricName, metricType, metricPerSecond, metricValue,
	timerMin, timerMax, timerCount, timerMean, timerMedian, timerStdDev, timerSum, timerSumSquares,
	userAgent string, metricsPerBatch int, maxRequests uint,
	maxRequestElapsedTime, flushInterval time.Duration,
	disabled gostatsd.TimerSubtypes, logger logrus.FieldLogger, pool *transport.TransportPool) (*Client, error)

NewClient returns a new New Relic client.

func (*Client) EventFormatter

func (n *Client) EventFormatter(e *gostatsd.Event) interface{}

EventFormatter formats gostatsd events

func (*Client) Name

func (n *Client) Name() string

Name returns the name of the backend.

func (*Client) RunMetrics

func (n *Client) RunMetrics(ctx context.Context, statser stats.Statser)

RunMetrics run metrics

func (*Client) SendEvent

func (n *Client) SendEvent(ctx context.Context, e *gostatsd.Event) error

SendEvent sends an event to New Relic.

func (*Client) SendMetricsAsync

func (n *Client) SendMetricsAsync(ctx context.Context, metrics *gostatsd.MetricMap, cb gostatsd.SendCallback)

SendMetricsAsync flushes the metrics to New Relic, preparing payload synchronously but doing the send asynchronously.

type NRInfraPayload

type NRInfraPayload struct {
	Name               string        `json:"name"`
	ProtocolVersion    string        `json:"protocol_version"`
	IntegrationVersion string        `json:"integration_version"`
	Data               []interface{} `json:"data"`
}

NRInfraPayload represents New Relic Infrastructure Payload format https://github.com/newrelic/infra-integrations-sdk/blob/master/docs/v2tov3.md#v2-json-full-sample

type NRMetric

type NRMetric struct {
	Name       string                 `json:"name"`
	Value      interface{}            `json:"value,omitempty"`
	Type       string                 `json:"type,omitempty"`
	Timestamp  int64                  `json:"timestamp,omitempty"`
	Attributes map[string]interface{} `json:"attributes,omitempty"`
	IntervalMs float64                `json:"interval.ms,omitempty"`
}

NRMetric metric for New Relic Metrics Format

type NRMetricsCommon

type NRMetricsCommon struct {
	Attributes map[string]interface{} `json:"attributes"`
	IntervalMs float64                `json:"interval.ms"`
}

NRMetricsCommon common attributes to apply for New Relic Metrics Format

type NRMetricsPayload

type NRMetricsPayload struct {
	Common  NRMetricsCommon `json:"common"`
	Metrics []interface{}   `json:"metrics"`
}

NRMetricsPayload represents New Relic Metrics Payload format https://docs.newrelic.com/docs/data-ingest-apis/get-data-new-relic/metric-api/report-metrics-metric-api#new-relic-guidelines

Jump to

Keyboard shortcuts

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