Documentation
¶
Index ¶
- Constants
- func NewClientFromViper(v *viper.Viper, logger logrus.FieldLogger, pool *transport.TransportPool) (gostatsd.Backend, error)
- type Client
- func (n *Client) EventFormatter(e *gostatsd.Event) interface{}
- func (n *Client) Name() string
- func (n *Client) Run(ctx context.Context)
- func (n *Client) SendEvent(ctx context.Context, e *gostatsd.Event) error
- func (n *Client) SendMetricsAsync(ctx context.Context, metrics *gostatsd.MetricMap, cb gostatsd.SendCallback)
- type NRInfraPayload
- type NRMetric
- type NRMetricsCommon
- type NRMetricsPayload
- type RetryAfterError
Constants ¶
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 ¶
EventFormatter formats gostatsd events
func (*Client) Run ¶
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) 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 ¶
RetryAfterError indicates if we should wait before retrying
func (RetryAfterError) Error ¶
func (r RetryAfterError) Error() string
Error returns the error message