Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#4624 Add the ability to specify a custom datadog URL #4800

Merged
merged 1 commit into from
Oct 5, 2018

Conversation

kevinconaway
Copy link
Contributor

@kevinconaway kevinconaway commented Oct 3, 2018

closes #4624

Required for all PRs:

  • [ Y] Signed CLA.
  • [ NA] Associated README.md updated.
  • [ NA] Has appropriate unit tests.

The existing tests covered this behavior

Copy link
Contributor

@danielnelson danielnelson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this will be a nice addition

func (d *Datadog) Connect() error {
if d.Apikey == "" {
return fmt.Errorf("apikey is a required field for datadog output")
}

if d.URL == "" {
d.URL = datadog_api
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set this in the init() function and then it will be overridden automatically when the plugin in loaded.

client *http.Client
}

var sampleConfig = `
## Datadog API key
apikey = "my-secret-key" # required.

# The base endpoint URL can optionally be specified but it defaults to:
url = "https://app.datadoghq.com/api/v1/series"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment this line out since it won't usually need to be set:

  ## The base endpoint URL can optionally be specified but it defaults to:
  # url = "https://app.datadoghq.com/api/v1/series"

https://github.com/influxdata/telegraf/wiki/SampleConfig

Copy link

@nkhanal0 nkhanal0 Jun 28, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
url = "https://app.datadoghq.com/api/v1/series"
url = "https://app.datadoghq.com/api/v1/series"

If the user is using an open source datadog-agent, this will be very useful to specify the url if they don't want to send the metrics to datadoghq.
For example:

/var/lib/dcos/telegraf/telegraf.d
[centos@x.x.x.x telegraf.d]$ cat datadog.conf 
# Transmit all metrics to Datadog
[[outputs.datadog]]
  ## Datadog API key
  apikey = "redacted"
  ## Connection timeout
  # timeout = "5s"
  ## URL
  url = "http://custom_url:443/api/v1/metrics"```   

@danielnelson danielnelson added the feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin label Oct 3, 2018
@kevinconaway
Copy link
Contributor Author

@danielnelson I've incorporated your feedback, thanks for your time!

@danielnelson danielnelson added this to the 1.9.0 milestone Oct 5, 2018
@danielnelson danielnelson merged commit 34caf12 into influxdata:master Oct 5, 2018
rgitzel pushed a commit to rgitzel/telegraf that referenced this pull request Oct 17, 2018
otherpirate pushed a commit to otherpirate/telegraf that referenced this pull request Mar 15, 2019
otherpirate pushed a commit to otherpirate/telegraf that referenced this pull request Mar 15, 2019
dupondje pushed a commit to dupondje/telegraf that referenced this pull request Apr 22, 2019
athoune pushed a commit to bearstech/telegraf that referenced this pull request Apr 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Added support for custom datadog URL
4 participants