newrelic

package
v0.0.0-...-65a99ba Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: MIT Imports: 23 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) Run

func (n *Client) Run(ctx context.Context)

Run will be ran in background until the supplied context is closed. It will register itself to flush events and update internal 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

type RetryAfterError

type RetryAfterError struct {
	Duration time.Duration
}

RetryAfterError indicates if we should wait before retrying

func (RetryAfterError) Error

func (r RetryAfterError) Error() string

Error returns the error message

Jump to

Keyboard shortcuts

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