Update docs for newrelic output

This commit is contained in:
Daniel Nelson 2020-05-27 11:52:21 -07:00
parent 580ac61cf7
commit 7b06624885
No known key found for this signature in database
GPG Key ID: CAAD59C9444F6155
4 changed files with 32 additions and 29 deletions

View File

@ -16,6 +16,10 @@
- [defaults](/plugins/processors/defaults/README.md) - Contributed by @jregistr - [defaults](/plugins/processors/defaults/README.md) - Contributed by @jregistr
- [filepath](/plugins/processors/filepath/README.md) - Contributed by @kir4h - [filepath](/plugins/processors/filepath/README.md) - Contributed by @kir4h
#### New Outputs
- [newrelic](/plugins/outputs/newrelic/README.md) - Contributed by @hsinghkalsi
#### Features #### Features
- [#6905](https://github.com/influxdata/telegraf/pull/6905): Add commands stats to mongodb input plugin. - [#6905](https://github.com/influxdata/telegraf/pull/6905): Add commands stats to mongodb input plugin.

View File

@ -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/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/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/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/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/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) - github.com/opencontainers/go-digest [Apache License 2.0](https://github.com/opencontainers/go-digest/blob/master/LICENSE)

View File

@ -1,22 +1,21 @@
#New Relic output plugin #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]] [[outputs.newrelic]]
## New Relic Insights API key ## New Relic Insights API key
insights_key = "insights api key" insights_key = "insights api key"
# metric_prefix if defined, prefix's metrics name for easy identification ## Prefix to add to add to metric name for easy identification.
# metric_prefix = "" # metric_prefix = ""
# harvest timeout, default is 15 seconds ## Timeout for writes to the New Relic API.
# timeout = "15s" # timeout = "15s"
``` ```
####Parameters
|Parameter Name|Type|Description| [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
| 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 |

View File

@ -16,14 +16,15 @@ import (
// NewRelic nr structure // NewRelic nr structure
type NewRelic struct { type NewRelic struct {
harvestor *telemetry.Harvester
dc *cumulative.DeltaCalculator
InsightsKey string `toml:"insights_key"` InsightsKey string `toml:"insights_key"`
MetricPrefix string `toml:"metric_prefix"` MetricPrefix string `toml:"metric_prefix"`
Timeout internal.Duration `toml:"timeout"` Timeout internal.Duration `toml:"timeout"`
savedErrors map[int]interface{}
errorCount int harvestor *telemetry.Harvester
Client http.Client dc *cumulative.DeltaCalculator
savedErrors map[int]interface{}
errorCount int
Client http.Client `toml:"-"`
} }
// Description returns a one-sentence description on the Output // 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 // SampleConfig : return default configuration of the Output
func (nr *NewRelic) SampleConfig() string { func (nr *NewRelic) SampleConfig() string {
return ` return `
## New Relic Insights API key (required) ## New Relic Insights API key
insights_key = "insights api key" insights_key = "insights api key"
# metric_prefix if defined, prefix's metrics name for easy identification (optional) ## Prefix to add to add to metric name for easy identification.
# metric_prefix = "" # metric_prefix = ""
# harvest timeout, default is 15 seconds ## Timeout for writes to the New Relic API.
# timeout = "15s" # timeout = "15s"
` `
} }
@ -77,7 +78,6 @@ func (nr *NewRelic) Connect() error {
// Close any connections to the Output // Close any connections to the Output
func (nr *NewRelic) Close() error { func (nr *NewRelic) Close() error {
nr.errorCount = 0 nr.errorCount = 0
nr.Client.CloseIdleConnections() nr.Client.CloseIdleConnections()
return nil return nil
@ -85,7 +85,6 @@ func (nr *NewRelic) Close() error {
// Write takes in group of points to be written to the Output // Write takes in group of points to be written to the Output
func (nr *NewRelic) Write(metrics []telegraf.Metric) error { func (nr *NewRelic) Write(metrics []telegraf.Metric) error {
nr.errorCount = 0 nr.errorCount = 0
nr.savedErrors = make(map[int]interface{}) nr.savedErrors = make(map[int]interface{})