Skip to content

Instantly share code, notes, and snippets.

@jkschneider
Created February 15, 2019 14:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jkschneider/a937cab4945a83b356f79c9331cd3e48 to your computer and use it in GitHub Desktop.
Save jkschneider/a937cab4945a83b356f79c9331cd3e48 to your computer and use it in GitHub Desktop.
How to send StatsD metrics over AMQP
@Bean
StatsdMeterRegistry statsdMeterRegistry(StatsdConfig config) {
return StatsdMeterRegistry.builder(config)
.lineSink(line -> {
// send this line to AMQP with your broker's client library
})
.build();
}
@jkschneider
Copy link
Author

jkschneider commented Feb 15, 2019

Since you're using Influx, you'll want to use the Telegraf StatsD flavor:

management.metrics.export.statsd.flavor=telegraf

Micrometer uses a variation on Nagle's algorithm to batch up tightly clustered StatsD line emissions into a single payload. You don't need to think about any of this. Just pop off whatever is on the AMQP message and stuff it directly in Telegraf on the high side. Depending on your configuration, you may be able to use the Telegraf AMQP consumer input plugin and not have a custom component on the high side.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment