From 7b0662488543446e51bd2fc3d04d20bfb66f3782 Mon Sep 17 00:00:00 2001 From: Daniel Nelson Date: Wed, 27 May 2020 11:52:21 -0700 Subject: [PATCH] Update docs for newrelic output --- CHANGELOG.md | 4 ++++ docs/LICENSE_OF_DEPENDENCIES.md | 1 + plugins/outputs/newrelic/README.md | 29 ++++++++++++++-------------- plugins/outputs/newrelic/newrelic.go | 27 +++++++++++++------------- 4 files changed, 32 insertions(+), 29 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 74d092c40..04e602708 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,10 @@ - [defaults](/plugins/processors/defaults/README.md) - Contributed by @jregistr - [filepath](/plugins/processors/filepath/README.md) - Contributed by @kir4h +#### New Outputs + +- [newrelic](/plugins/outputs/newrelic/README.md) - Contributed by @hsinghkalsi + #### Features - [#6905](https://github.com/influxdata/telegraf/pull/6905): Add commands stats to mongodb input plugin. diff --git a/docs/LICENSE_OF_DEPENDENCIES.md b/docs/LICENSE_OF_DEPENDENCIES.md index 4b811d8b7..9e19d74d7 100644 --- a/docs/LICENSE_OF_DEPENDENCIES.md +++ b/docs/LICENSE_OF_DEPENDENCIES.md @@ -107,6 +107,7 @@ following works: - github.com/nats-io/nats.go [Apache License 2.0](https://github.com/nats-io/nats.go/blob/master/LICENSE) - github.com/nats-io/nkeys [Apache License 2.0](https://github.com/nats-io/nkeys/blob/master/LICENSE) - github.com/nats-io/nuid [Apache License 2.0](https://github.com/nats-io/nuid/blob/master/LICENSE) +- github.com/newrelic/newrelic-telemetry-sdk-go [Apache License 2.0](https://github.com/newrelic/newrelic-telemetry-sdk-go/blob/master/LICENSE.md) - github.com/nsqio/go-nsq [MIT License](https://github.com/nsqio/go-nsq/blob/master/LICENSE) - github.com/openconfig/gnmi [Apache License 2.0](https://github.com/openconfig/gnmi/blob/master/LICENSE) - github.com/opencontainers/go-digest [Apache License 2.0](https://github.com/opencontainers/go-digest/blob/master/LICENSE) diff --git a/plugins/outputs/newrelic/README.md b/plugins/outputs/newrelic/README.md index 323595711..ae056ed2f 100644 --- a/plugins/outputs/newrelic/README.md +++ b/plugins/outputs/newrelic/README.md @@ -1,22 +1,21 @@ #New Relic output plugin - -This plugins writes to New Relic insights. -``` +This plugins writes to New Relic Insights using the [Metrics API][]. + +To use this plugin you must first obtain an [Insights API Key][]. + +### Configuration +```toml [[outputs.newrelic]] -## New Relic Insights API key -insights_key = "insights api key" + ## New Relic Insights API key + insights_key = "insights api key" -# metric_prefix if defined, prefix's metrics name for easy identification -# metric_prefix = "" + ## Prefix to add to add to metric name for easy identification. + # metric_prefix = "" -# harvest timeout, default is 15 seconds -# timeout = "15s" + ## Timeout for writes to the New Relic API. + # timeout = "15s" ``` -####Parameters -|Parameter Name|Type|Description| -|:-|:-|:-| -| insights_key | Required | Insights API Insert key | -| metric_prefix | Optional | If defined, prefix's metrics name for easy identification | -| timeout | Optional | If defined, changes harvest timeout | +[Metrics API]: https://docs.newrelic.com/docs/data-ingest-apis/get-data-new-relic/metric-api/introduction-metric-api +[Insights API Key]: https://docs.newrelic.com/docs/apis/get-started/intro-apis/types-new-relic-api-keys#user-api-key diff --git a/plugins/outputs/newrelic/newrelic.go b/plugins/outputs/newrelic/newrelic.go index 07e2569c3..da000c222 100644 --- a/plugins/outputs/newrelic/newrelic.go +++ b/plugins/outputs/newrelic/newrelic.go @@ -16,14 +16,15 @@ import ( // NewRelic nr structure type NewRelic struct { - harvestor *telemetry.Harvester - dc *cumulative.DeltaCalculator InsightsKey string `toml:"insights_key"` MetricPrefix string `toml:"metric_prefix"` Timeout internal.Duration `toml:"timeout"` - savedErrors map[int]interface{} - errorCount int - Client http.Client + + harvestor *telemetry.Harvester + dc *cumulative.DeltaCalculator + savedErrors map[int]interface{} + errorCount int + Client http.Client `toml:"-"` } // Description returns a one-sentence description on the Output @@ -34,14 +35,14 @@ func (nr *NewRelic) Description() string { // SampleConfig : return default configuration of the Output func (nr *NewRelic) SampleConfig() string { return ` - ## New Relic Insights API key (required) - insights_key = "insights api key" + ## New Relic Insights API key + insights_key = "insights api key" - # metric_prefix if defined, prefix's metrics name for easy identification (optional) - # metric_prefix = "" - - # harvest timeout, default is 15 seconds - # timeout = "15s" + ## Prefix to add to add to metric name for easy identification. + # metric_prefix = "" + + ## Timeout for writes to the New Relic API. + # timeout = "15s" ` } @@ -77,7 +78,6 @@ func (nr *NewRelic) Connect() error { // Close any connections to the Output func (nr *NewRelic) Close() error { - nr.errorCount = 0 nr.Client.CloseIdleConnections() return nil @@ -85,7 +85,6 @@ func (nr *NewRelic) Close() error { // Write takes in group of points to be written to the Output func (nr *NewRelic) Write(metrics []telegraf.Metric) error { - nr.errorCount = 0 nr.savedErrors = make(map[int]interface{})