Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
5d41f60e
Commit
5d41f60e
authored
Jun 26, 2020
by
Lee Dobryden
Committed by
Andy Wilkinson
Jun 29, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add StatsD transport protocol configuration option
See gh-22125
parent
5de67e9b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
1 deletion
+27
-1
StatsdProperties.java
...autoconfigure/metrics/export/statsd/StatsdProperties.java
+14
-0
StatsdPropertiesConfigAdapter.java
.../metrics/export/statsd/StatsdPropertiesConfigAdapter.java
+6
-0
additional-spring-configuration-metadata.json
...es/META-INF/additional-spring-configuration-metadata.json
+4
-0
StatsdPropertiesTests.java
...onfigure/metrics/export/statsd/StatsdPropertiesTests.java
+1
-0
production-ready-features.adoc
...oot-docs/src/docs/asciidoc/production-ready-features.adoc
+2
-1
No files found.
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/statsd/StatsdProperties.java
View file @
5d41f60e
...
@@ -19,6 +19,7 @@ package org.springframework.boot.actuate.autoconfigure.metrics.export.statsd;
...
@@ -19,6 +19,7 @@ package org.springframework.boot.actuate.autoconfigure.metrics.export.statsd;
import
java.time.Duration
;
import
java.time.Duration
;
import
io.micrometer.statsd.StatsdFlavor
;
import
io.micrometer.statsd.StatsdFlavor
;
import
io.micrometer.statsd.StatsdProtocol
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
...
@@ -53,6 +54,11 @@ public class StatsdProperties {
...
@@ -53,6 +54,11 @@ public class StatsdProperties {
*/
*/
private
Integer
port
=
8125
;
private
Integer
port
=
8125
;
/**
* Protocol of the StatsD server to receive exported metrics.
*/
private
StatsdProtocol
protocol
=
StatsdProtocol
.
UDP
;
/**
/**
* Total length of a single payload should be kept within your network's MTU.
* Total length of a single payload should be kept within your network's MTU.
*/
*/
...
@@ -102,6 +108,14 @@ public class StatsdProperties {
...
@@ -102,6 +108,14 @@ public class StatsdProperties {
this
.
port
=
port
;
this
.
port
=
port
;
}
}
public
StatsdProtocol
getProtocol
()
{
return
this
.
protocol
;
}
public
void
setProtocol
(
StatsdProtocol
protocol
)
{
this
.
protocol
=
protocol
;
}
public
Integer
getMaxPacketLength
()
{
public
Integer
getMaxPacketLength
()
{
return
this
.
maxPacketLength
;
return
this
.
maxPacketLength
;
}
}
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/statsd/StatsdPropertiesConfigAdapter.java
View file @
5d41f60e
...
@@ -20,6 +20,7 @@ import java.time.Duration;
...
@@ -20,6 +20,7 @@ import java.time.Duration;
import
io.micrometer.statsd.StatsdConfig
;
import
io.micrometer.statsd.StatsdConfig
;
import
io.micrometer.statsd.StatsdFlavor
;
import
io.micrometer.statsd.StatsdFlavor
;
import
io.micrometer.statsd.StatsdProtocol
;
import
org.springframework.boot.actuate.autoconfigure.metrics.export.properties.PropertiesConfigAdapter
;
import
org.springframework.boot.actuate.autoconfigure.metrics.export.properties.PropertiesConfigAdapter
;
...
@@ -65,6 +66,11 @@ public class StatsdPropertiesConfigAdapter extends PropertiesConfigAdapter<Stats
...
@@ -65,6 +66,11 @@ public class StatsdPropertiesConfigAdapter extends PropertiesConfigAdapter<Stats
return
get
(
StatsdProperties:
:
getPort
,
StatsdConfig
.
super
::
port
);
return
get
(
StatsdProperties:
:
getPort
,
StatsdConfig
.
super
::
port
);
}
}
@Override
public
StatsdProtocol
protocol
()
{
return
get
(
StatsdProperties:
:
getProtocol
,
StatsdConfig
.
super
::
protocol
);
}
@Override
@Override
public
int
maxPacketLength
()
{
public
int
maxPacketLength
()
{
return
get
(
StatsdProperties:
:
getMaxPacketLength
,
StatsdConfig
.
super
::
maxPacketLength
);
return
get
(
StatsdProperties:
:
getMaxPacketLength
,
StatsdConfig
.
super
::
maxPacketLength
);
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json
View file @
5d41f60e
...
@@ -463,6 +463,10 @@
...
@@ -463,6 +463,10 @@
"name"
:
"management.metrics.export.statsd.flavor"
,
"name"
:
"management.metrics.export.statsd.flavor"
,
"defaultValue"
:
"datadog"
"defaultValue"
:
"datadog"
},
},
{
"name"
:
"management.metrics.export.statsd.protocol"
,
"defaultValue"
:
"udp"
},
{
{
"name"
:
"management.metrics.export.statsd.queue-size"
,
"name"
:
"management.metrics.export.statsd.queue-size"
,
"defaultValue"
:
2147483647
,
"defaultValue"
:
2147483647
,
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/statsd/StatsdPropertiesTests.java
View file @
5d41f60e
...
@@ -36,6 +36,7 @@ class StatsdPropertiesTests {
...
@@ -36,6 +36,7 @@ class StatsdPropertiesTests {
assertThat
(
properties
.
getFlavor
()).
isEqualTo
(
config
.
flavor
());
assertThat
(
properties
.
getFlavor
()).
isEqualTo
(
config
.
flavor
());
assertThat
(
properties
.
getHost
()).
isEqualTo
(
config
.
host
());
assertThat
(
properties
.
getHost
()).
isEqualTo
(
config
.
host
());
assertThat
(
properties
.
getPort
()).
isEqualTo
(
config
.
port
());
assertThat
(
properties
.
getPort
()).
isEqualTo
(
config
.
port
());
assertThat
(
properties
.
getProtocol
()).
isEqualTo
(
config
.
protocol
());
assertThat
(
properties
.
getMaxPacketLength
()).
isEqualTo
(
config
.
maxPacketLength
());
assertThat
(
properties
.
getMaxPacketLength
()).
isEqualTo
(
config
.
maxPacketLength
());
assertThat
(
properties
.
getPollingFrequency
()).
isEqualTo
(
config
.
pollingFrequency
());
assertThat
(
properties
.
getPollingFrequency
()).
isEqualTo
(
config
.
pollingFrequency
());
assertThat
(
properties
.
isPublishUnchangedMeters
()).
isEqualTo
(
config
.
publishUnchangedMeters
());
assertThat
(
properties
.
isPublishUnchangedMeters
()).
isEqualTo
(
config
.
publishUnchangedMeters
());
...
...
spring-boot-project/spring-boot-docs/src/docs/asciidoc/production-ready-features.adoc
View file @
5d41f60e
...
@@ -1764,12 +1764,13 @@ You can also change the interval at which metrics are sent to Stackdriver:
...
@@ -1764,12 +1764,13 @@ You can also change the interval at which metrics are sent to Stackdriver:
==== StatsD
==== StatsD
The StatsD registry pushes metrics over UDP to a StatsD agent eagerly.
The StatsD registry pushes metrics over UDP to a StatsD agent eagerly.
By default, metrics are exported to a {micrometer-registry-docs}/statsd[StatsD] agent running on your local machine.
By default, metrics are exported to a {micrometer-registry-docs}/statsd[StatsD] agent running on your local machine.
The StatsD agent host
and port
to use can be provided using:
The StatsD agent host
,port, and protocol
to use can be provided using:
[source,properties,indent=0,configprops]
[source,properties,indent=0,configprops]
----
----
management.metrics.export.statsd.host=statsd.example.com
management.metrics.export.statsd.host=statsd.example.com
management.metrics.export.statsd.port=9125
management.metrics.export.statsd.port=9125
management.metrics.export.statsd.protocol=udp
----
----
You can also change the StatsD line protocol to use (default to Datadog):
You can also change the StatsD line protocol to use (default to Datadog):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment