I have a Spring Boot Java app and am sending metrics to a hierarchical Graphite metrics system. I'm using the management.metrics.export.graphite.tags-as-prefix and mapping host and app to prefix my metrics. I then have a metric with namespace jvm.memory.committed
, but the metric namespace is coming over the wire as host.app.jvmMemoryCommitted.*
. So it's replacing dots (".") in the metric namespace and camelCasing the following piece of the namespace.
application.properties
management.metrics.export.graphite.tags-as-prefix=[host, app]
Customizer for tags as prefix.
@Bean
public MeterRegistryCustomizer<MeterRegistry> commonTags() {
return r -> r.config().commonTags("host", "localhost", "app", "app");
}
When I look at the .../actuator/metrics/jvm.memory.committed endpoint I see the following:
"name": "jvm.memory.committed",
"description": "The amount of memory in bytes that is committed for the Java virtual machine to use",
"baseUnit": "bytes",
"measurements": [
{
"statistic": "VALUE",
"value": 759701504
}
],
"availableTags": [
{
"tag": "area",
"values": [
"heap",
"nonheap"
]
},
{
"tag": "app",
"values": [
"app"
]
},
{
"tag": "host",
"values": [
"localhost"
]
},
{
"tag": "id",
"values": [
"G1 Old Gen",
"CodeHeap 'non-profiled nmethods'",
"G1 Survivor Space",
"Compressed Class Space",
"Metaspace",
"G1 Eden Space",
"CodeHeap 'non-nmethods'"
]
},
]
}
However, when the metrics are being sent with the metric names changed from *.jvm.memory.committed.*
to *.jvmMemoryCommitted.*
. How can I preserve the metrics namespace in dot-notation?
See the tcpdump output below:
$ sudo tcpdump -i any -A -s0 -vv udp port 2003 | grep -i committed
tcpdump: data link type PKTAP
tcpdump: listening on any, link-type PKTAP (Apple DLT_PKTAP), capture size 262144 bytes
....E....5..@............E...p..localhost.app.jvmMemoryCommitted.area.heap.id.G1_Eden_Space 178257920.00 1628102627
....E....5..@............E...p..localhost.app.jvmMemoryCommitted.area.heap.id.G1_Eden_Space 178257920.00 1628102627
....E...o...@............E...m..localhost.app.jvmMemoryCommitted.area.heap.id.G1_Old_Gen 465567744.00 1628102627
....E...o...@............E...m..localhost.app.jvmMemoryCommitted.area.heap.id.G1_Old_Gen 465567744.00 1628102627
....E.......@............E...s..localhost.app.jvmMemoryCommitted.area.heap.id.G1_Survivor_Space 10485760.00 1628102627
....E.......@............E...s..localhost.app.jvmMemoryCommitted.area.heap.id.G1_Survivor_Space 10485760.00 1628102627
....E...m...@............E...{..localhost.app.jvmMemoryCommitted.area.nonheap.id.CodeHeap_'non-nmethods' 3604480.00 1628102627
....E...m...@............E...{..localhost.app.jvmMemoryCommitted.area.nonheap.id.CodeHeap_'non-nmethods' 3604480.00 1628102627
....E....J..@............E......localhost.app.jvmMemoryCommitted.area.nonheap.id.CodeHeap_'non-profiled_nmethods' 10420224.00 1628102627
....E....J..@............E......localhost.app.jvmMemoryCommitted.area.nonheap.id.CodeHeap_'non-profiled_nmethods' 10420224.00 1628102627
....E.......@............E...z..localhost.app.jvmMemoryCommitted.area.nonheap.id.Compressed_Class_Space 9306112.00 1628102627
....E.......@............E...z..localhost.app.jvmMemoryCommitted.area.nonheap.id.Compressed_Class_Space 9306112.00 1628102627
....E....,..@............E...n..localhost.app.jvmMemoryCommitted.area.nonheap.id.Metaspace 69607424.00 1628102627
....E....,..@............E...n..localhost.app.jvmMemoryCommitted.area.nonheap.id.Metaspace 69607424.00 1628102627
^C444 packets captured
3200 packets received by filter
0 packets dropped by kernel```
I think the problem is that I'm using tags, but in a Hierarchical metrics system, but I can't figure out how to configure it properly. I can't seem to find my folly.
Spring Boot 2.5.2
Micrometer Core and Micrometer Registry Graphite 1.7.2