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

graphite api: add support for sending metrics over UDP #546

Merged
merged 1 commit into from
May 16, 2014

Conversation

peekeri
Copy link
Contributor

@peekeri peekeri commented May 16, 2014

There already exists an API for sending metrics to InfluxDB over TCP using
Graphite plaintext protocol. Sometimes it is more convenient to send metrics
over UDP, so adding that support for the Graphite as well. For now at least,
using the same port for UDP traffic than for TCP to make configuration really
simple.

UDP listener is disabled by default, but can be turned on by setting udp_enabled
to true in graphite plugin configuration.

There are already quite a few libraries and other solutions supporting Graphite UDP API, so this makes starting use of InfluxDB easier. One particular case where this is useful is when using StatsD as it natively supports using Graphite as the metrics backend, but it uses UDP to send metrics. This change should make InfluxDB a drop-in replacement for Graphite as StatsD backend.

There already exists an API for sending metrics to InfluxDB over TCP using
Graphite plaintext protocol. Sometimes it is more convenient to send metrics
over UDP, so adding that support for the Graphite as well. For now at least,
using the same port for UDP traffic than for TCP to make configuration really
simple.

UDP listener is disabled by default, but can be turned on by setting udp_enabled
to true in graphite plugin configuration.
@pauldix
Copy link
Member

pauldix commented May 16, 2014

I think it would be better to have a config option to set the UDP port so you could have both running at the same time. Otherwise, looks great.

@peekeri
Copy link
Contributor Author

peekeri commented May 16, 2014

@pauldix I can add also config option for the UDP port if that is wanted, but if you set udp_enabled = true already now, it listens to both UDP and TCP traffic.

I tested by running locally and running:

echo "random_metric 2 `date +%s`" | nc -uw1 localhost 2003
echo "random_metric 4 `date +%s`" | nc localhost 2003

Both values for "random_metric" appear in the database.

@pauldix
Copy link
Member

pauldix commented May 16, 2014

Ah, nevermind then! If it's ok to sign a CLA we can merge this in right away http://influxdb.org/community/cla.html

@peekeri
Copy link
Contributor Author

peekeri commented May 16, 2014

@pauldix CLA signed.

pauldix added a commit that referenced this pull request May 16, 2014
graphite api: add support for sending metrics over UDP
@pauldix pauldix merged commit 6a74cfd into influxdata:master May 16, 2014
@pauldix
Copy link
Member

pauldix commented May 16, 2014

Awesome, thanks @peekeri! It'll go out in the next release

@Dieterbe
Copy link
Contributor

using StatsD as it natively supports using Graphite as the metrics backend, but it uses UDP to send metrics. This change should make InfluxDB a drop-in replacement for Graphite as StatsD backend.

this is incorrect. statsd sends data to graphite over a tcp connection. you don't need this patch to use influxdb as a graphite backend in statsd.

I actually never have encountered any agent or tool that sends data to graphite over udp.
I have no big objections against supporting the graphite protocol over UDP but i would like to see at least one OSS tool to actually leverage this (and providing a good reason to use it instead of tcp)

@peekeri
Copy link
Contributor Author

peekeri commented May 21, 2014

@Dieterbe you are absolutely correct, I made a mistake in claiming that. I mixed this with ganglia being able to forward metrics to carbon collector over UDP (if configured to do so). See https://github.com/ganglia/monitor-core/blob/master/gmetad/gmetad.conf.in and specifically carbon_protocol setting, that can be set to udp.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants