Default Actuator Metrics

Introduction

Spring Boot Actuator provides several built-in metrics that are useful for monitoring the application. These include JVM metrics, HTTP metrics, datasource metrics, and cache metrics. This section provides examples of each type and how they are typically referenced in Grafana.

JVM Metrics

JVM metrics provide insights into the Java Virtual Machine’s performance and resource usage.

  • Memory Usage: Measures the amount of memory used by the JVM. Example: jvm_memory_used_bytes{area="heap"} - the amount of heap memory used. Grafana Query: jvm_memory_used_bytes{area="heap"}

  • Garbage Collection: Tracks the time spent in garbage collection. Example: jvm_gc_pause_seconds_count - the number of GC pauses. Grafana Query: jvm_gc_pause_seconds_count

  • Threads: Monitors the number of active threads. Example: jvm_threads_live - the number of live threads. Grafana Query: jvm_threads_live

HTTP Metrics

HTTP metrics provide information about the HTTP requests handled by the application.

  • Request Count: Counts the number of HTTP requests received. Example: http_server_requests_seconds_count - the total number of HTTP requests. Grafana Query: http_server_requests_seconds_count

  • Response Times: Measures the duration of HTTP requests. Example: http_server_requests_seconds_sum - the total duration of all HTTP requests. Grafana Query: http_server_requests_seconds_sum

  • Status Codes: Tracks the HTTP response status codes. Example: http_server_requests_seconds_count{status="200"} - the number of HTTP 200 responses. Grafana Query: http_server_requests_seconds_count{status="200"}

Datasource Metrics

Datasource metrics provide information about the database connection pool.

  • Connection Pool Usage: Measures the usage of the connection pool. Example: hikaricp_connections_active - the number of active connections. Grafana Query: hikaricp_connections_active

  • Active Connections: Tracks the number of active database connections. Example: hikaricp_connections - the total number of connections. Grafana Query: hikaricp_connections

Cache Metrics

Cache metrics provide insights into the performance of the caching system. For Redis, the following metrics are commonly used:

  • Cache Hits: Counts the number of cache hits. Example: redis_cache_hits_total - the total number of cache hits. Grafana Query: redis_cache_hits_total

  • Misses: Counts the number of cache misses. Example: redis_cache_misses_total - the total number of cache misses. Grafana Query: redis_cache_misses_total

  • Usage Statistics: Measures the usage statistics of the cache. Example: redis_evictions_total - the total number of cache evictions. Grafana Query: redis_evictions_total

Understanding these metrics and how to reference them in Grafana will help you effectively monitor and analyze the performance and health of your OCS.io application.