pom.xml
)<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> <dependency> <groupId>io.micrometer</groupId> <artifactId>micrometer-registry-prometheus</artifactId> </dependency>
application.properties
)#Metrics related configurations management.endpoint.metrics.enabled=true management.endpoints.web.exposure.include=* management.endpoint.prometheus.enabled=true management.metrics.export.prometheus.enabled=true
prometheus監控指標web
prometheus.yml
)#Global configurations global: scrape_interval: 5s # Set the scrape interval to every 5 seconds. evaluation_interval: 5s # Evaluate rules every 5 seconds. scrape_configs: - job_name: 'spring-boot' metrics_path: '/actuator/prometheus' static_configs: - targets: ['localhost:8080']
./perometheus --config.file=prometheus.yml
jvm_memory_committed_bytes
image.pngspring
jvm_threads_states_threads
jvm_memory_used_bytes
process_cpu_usage
rate(http_server_requests_seconds_sum[5m])
jvm_gc_pause_seconds_count