Skip to content

Instantly share code, notes, and snippets.

@dpsoft
Last active January 16, 2020 13:39
Show Gist options
  • Save dpsoft/2cc9a2ba3126f5c40ee59e0d3783320c to your computer and use it in GitHub Desktop.
Save dpsoft/2cc9a2ba3126f5c40ee59e0d3783320c to your computer and use it in GitHub Desktop.
kamon-spring-example
package com.example.demo;
import kamon.Kamon;
import kamon.prometheus.PrometheusReporter;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class KamonSpringExampleApplication {
public static void main(String[] args) {
Kamon.init();
Kamon.registerModule("prometheus-reporter", new PrometheusReporter());
SpringApplication.run(KamonSpringExampleApplication.class, args);
}
}
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>kamon-spring-example</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.kamon</groupId>
<artifactId>kamon-bundle_2.12</artifactId>
<version>2.0.5</version>
</dependency>
<dependency>
<groupId>io.kamon</groupId>
<artifactId>kamon-prometheus_2.12</artifactId>
<version>2.0.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
# HELP jvm_memory_allocation_bytes_total Tracks the number amount of bytes allocated
# TYPE jvm_memory_allocation_bytes_total counter
jvm_memory_allocation_bytes_total{component="jvm"} 250609664.0
# HELP host_network_data_write_bytes_total Counts how many bytes have been written to a network interface
# TYPE host_network_data_write_bytes_total counter
host_network_data_write_bytes_total{interface="wlp2s0",component="host"} 576061.0
host_network_data_write_bytes_total{interface="virbr0",component="host"} 0.0
# HELP host_storage_device_ops_read_total Counts the number of read operations executed on a storage device
# TYPE host_storage_device_ops_read_total counter
host_storage_device_ops_read_total{device="/dev/sda",component="host"} 4319.0
# HELP host_storage_device_data_write_bytes_total Counts the amount of byes that have been written to a storage device
# TYPE host_storage_device_data_write_bytes_total counter
host_storage_device_data_write_bytes_total{device="/dev/sda",component="host"} 245714944.0
# HELP host_network_packets_write_total_total Counts how many packets have been written to a network interface
# TYPE host_network_packets_write_total_total counter
host_network_packets_write_total_total{interface="wlp2s0",component="host"} 2810.0
host_network_packets_write_total_total{interface="virbr0",component="host"} 0.0
# HELP host_storage_device_ops_write_total Counts the number of write operations executed on a storage device
# TYPE host_storage_device_ops_write_total counter
host_storage_device_ops_write_total{device="/dev/sda",component="host"} 31582.0
# HELP host_network_data_read_bytes_total Counts how many bytes have been read from a network interface
# TYPE host_network_data_read_bytes_total counter
host_network_data_read_bytes_total{interface="wlp2s0",component="host"} 5889069.0
host_network_data_read_bytes_total{interface="virbr0",component="host"} 0.0
# HELP host_storage_device_data_read_bytes_total Counts the amount of byes that have been read from a storage device
# TYPE host_storage_device_data_read_bytes_total counter
host_storage_device_data_read_bytes_total{device="/dev/sda",component="host"} 53235712.0
# HELP host_network_packets_write_failed_total Counts how many packets failed to be written to a network interface
# TYPE host_network_packets_write_failed_total counter
host_network_packets_write_failed_total{interface="wlp2s0",component="host"} 0.0
host_network_packets_write_failed_total{interface="virbr0",component="host"} 0.0
# HELP host_network_packets_read_failed_total Counts how many packets failed to be read from a network interface
# TYPE host_network_packets_read_failed_total counter
host_network_packets_read_failed_total{interface="wlp2s0",component="host"} 0.0
host_network_packets_read_failed_total{interface="virbr0",component="host"} 0.0
# HELP host_network_packets_read_total_total Counts how many packets have been read from a network interface
# TYPE host_network_packets_read_total_total counter
host_network_packets_read_total_total{interface="wlp2s0",component="host"} 5981.0
host_network_packets_read_total_total{interface="virbr0",component="host"} 0.0
# HELP kamon_trace_sampler_decisions_total Counts how many sampling decisions have been taking by Kamon's current sampler.
# TYPE kamon_trace_sampler_decisions_total counter
kamon_trace_sampler_decisions_total{decision="sample",sampler="adaptive"} 0.0
kamon_trace_sampler_decisions_total{decision="do-not-sample",sampler="constant"} 0.0
kamon_trace_sampler_decisions_total{decision="do-not-sample",sampler="adaptive"} 0.0
kamon_trace_sampler_decisions_total{decision="sample",sampler="constant"} 0.0
# HELP jvm_memory_committed_bytes Tracks the committed space in a memory region
# TYPE jvm_memory_committed_bytes gauge
jvm_memory_committed_bytes{region="heap",component="jvm"} 212860928.0
jvm_memory_committed_bytes{region="non-heap",component="jvm"} 41680896.0
# HELP jvm_threads_peak Tracks the peak live thread count since the JVM started
# TYPE jvm_threads_peak gauge
jvm_threads_peak 31.0
# HELP process_ulimit_file_descriptors_max Tracks the max number of file descriptors that can be used by the process
# TYPE process_ulimit_file_descriptors_max gauge
process_ulimit_file_descriptors_max{component="process"} 524288.0
# HELP host_swap_used_bytes Tracks the used Swap space
# TYPE host_swap_used_bytes gauge
host_swap_used_bytes{component="host"} 7053877248.0
# HELP host_memory_total_bytes Tracks the total memory available
# TYPE host_memory_total_bytes gauge
host_memory_total_bytes{component="host"} 16663846912.0
# HELP host_memory_used_bytes Tracks the amount of used memory
# TYPE host_memory_used_bytes gauge
host_memory_used_bytes{component="host"} 13533085696.0
# HELP host_storage_mount_space_used_bytes Tracks the used space on a file system mount/volume
# TYPE host_storage_mount_space_used_bytes gauge
host_storage_mount_space_used_bytes{mount="/home",component="host"} 169658036224.0
host_storage_mount_space_used_bytes{mount="/boot/efi",component="host"} 20754432.0
host_storage_mount_space_used_bytes{mount="/",component="host"} 41621577728.0
host_storage_mount_space_used_bytes{mount="/boot",component="host"} 292364288.0
# HELP host_swap_total_bytes Tracks the total Swap space
# TYPE host_swap_total_bytes gauge
host_swap_total_bytes{component="host"} 8403283968.0
# HELP jvm_memory_max_bytes Tracks the max space in a memory region
.....
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment