Prometheus Metrics with SpringBoot + GRPC Services
Blog post from StackHawk
A small startup utilizing LogNet's SpringBoot GRPC library for internal communications faced a challenge due to the lack of native Micrometer support, which GRPC itself does not expose to Spring. To address this, they implemented a basic setup to integrate Micrometer with their GRPC services for metrics collection, adding dependencies in their build file and exposing endpoints for HTTP metrics and Prometheus scraping. Operating within Kubernetes, they configured Prometheus to discover and scrape service pods, enabling monitoring of method timings through standard Spring/Micrometer practices and enhancing exception metrics by integrating a Micrometer registry counter within their GRPC exception handler. This setup, which involves annotating methods for timing and incrementing counters for exceptions, allowed the team to collect and analyze metrics like average GRPC call lengths and exception occurrences using Prometheus and PromQL.