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

Allow connecting to prometheus via socket #4798

Merged
merged 3 commits into from
Nov 3, 2018
Merged

Conversation

glinton
Copy link
Contributor

@glinton glinton commented Oct 3, 2018

Based on, and closes #2974

@glinton glinton added this to the 1.9.0 milestone Oct 3, 2018
@glinton glinton added feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin area/prometheus area/k8s labels Oct 3, 2018
@danielnelson
Copy link
Contributor

I think there is a race condition if there are both http and unix socket connections, since the dialer is being replaced. It seems we would need one transport per unix socket plus one shared for http.

One way we could deal with this is by allowing only a single socket:

[[inputs.prometheus]]
  urls = ["http://localhost/metrics"]
  unix_socket = "/var/run/prometheus.sock"

This is basically how curl added support for unix sockets. If you need multiple sockets you would need to define multiple inputs. The path would be defined in the urls, and this could support query parameters or even TLS, though I'm unsure how useful those are. You could still have multiple urls, but this would only be useful if they have differing paths because all calls would go to the socket.

If we did this a plugin would only need a single transport and I think it would keep things simple.

@danielnelson danielnelson merged commit ddcbfe7 into master Nov 3, 2018
@danielnelson danielnelson deleted the prometheus-sockets branch November 3, 2018 00:51
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
area/k8s area/prometheus 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.

2 participants