feat(EM-41): Upgrade Micrometer/Prometheus Metrics and Add Service-Level Dashboards#164
Open
devin-ai-integration[bot] wants to merge 4 commits intofeat/microservices-migration-v5from
Conversation
…vel dashboards - Micrometer 1.12.2 already in version catalog; added micrometer-core library and observability bundle - Created ftgo-observability shared library with auto-configuration and per-service business metrics - Created ftgo.observability-conventions Gradle convention plugin - Added observability plugin + ftgo-observability dependency to all 4 services - Defined custom business metrics: OrderMetrics, ConsumerMetrics, RestaurantMetrics, CourierMetrics - Configured Prometheus scrape targets for all services (prometheus/prometheus.yml) - Created alerting rules: error rate >5%, latency p99 >2s, heap >90%, GC pause, DB pool (prometheus/alert_rules.yml) - Created 4 Grafana dashboards: Service Health (RED), JVM Metrics, Business Metrics, DB Connection Pool - Added Prometheus + Grafana to docker-compose.yml for local development - Configured metrics endpoints on separate management port (8081) for security - Enhanced application.yml with percentile histograms and SLA buckets Co-Authored-By: mason.batchelor <masonbatchelor81@gmail.com>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
…tasource UID, update deprecated sla property - Use @autoConfiguration instead of @configuration for Spring Boot 3.2 idiomatic auto-config - Add explicit uid: prometheus to Grafana datasource provisioning to match dashboard references - Replace deprecated management.metrics.distribution.sla with service-level-objectives in all services Co-Authored-By: mason.batchelor <masonbatchelor81@gmail.com>
Merged upstream changes including security config, CORS, OpenAPI/springdoc, CI workflows, Docker configs, and ftgo-security library. Combined with our observability additions: SLO buckets, management port 8081, Prometheus export, upgraded Prometheus/Grafana versions, and Grafana datasource UID fix. Co-Authored-By: mason.batchelor <masonbatchelor81@gmail.com>
The merge auto-resolution duplicated the observability bundle definition in libs.versions.toml, causing Gradle TOML parsing failure. Co-Authored-By: mason.batchelor <masonbatchelor81@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a full observability stack (Micrometer 1.12.2 + Prometheus + Grafana) to the FTGO microservices platform. This includes:
ftgo-observabilityshared library (shared-libraries/ftgo-observability/) withObservabilityAutoConfiguration(common metric tags) and per-service business metric helper classes (OrderMetrics,ConsumerMetrics,RestaurantMetrics,CourierMetrics)ftgo.observability-conventionsGradle plugin that bundles Actuator + Micrometer Core + Prometheus registry as a single dependencyprometheus/) with scrape targets for all 4 services and alerting rules (error rate >5%, p99 >2s, heap >90%, GC, DB pool, service down)grafana/dashboards/): Service Health (RED), JVM Metrics, Business Metrics, Database Connection Poolapplication.ymlupdates for all 4 services: management port on 8081, percentile histograms, SLO buckets, plus merged security/CORS/OpenAPI config from base branchThe version catalog already had Micrometer at 1.12.2; this PR adds an
observabilitybundle grouping Actuator + Micrometer Core + Prometheus registry.Updates since last revision
feat/microservices-migration-v5(base branch had an earlier version of observability infrastructure)observabilitybundle inlibs.versions.tomlcaused by the merge auto-resolutionapplication.ymlfiles:spring.security.user,ftgo.security.cors,ftgo.openapi,springdocconfig now coexist with our observability settingscontainer_name,restart: unless-stopped, console libraries) with upgraded image versions (Prometheus v2.49.1, Grafana 10.3.1)ObservabilityAutoConfigurationuses@AutoConfiguration(Spring Boot 3.2 idiomatic) instead of@Configurationuid: prometheusto match dashboard referencesmanagement.metrics.distribution.slawithservice-level-objectivesin all 4 serviceapplication.ymlfilesReview & Testing Checklist for Human
@Component+@ConditionalOnPropertyon each metrics class (auto-wired per service). This PR removes those annotations, making the classes plain POJOs (scaffolding only, not wired as beans). If the base branch's auto-wiring was intentional, this is a regression. Decide whether to restore@Component/@ConditionalOnPropertyor keep as scaffolding.uid: "prometheus"instead of${DS_PROMETHEUS}variable. The base branch dashboards used a templated datasource variable; this PR hardcodes the UID. This works with the provisioned datasource (which setsuid: prometheus) but won't work if dashboards are imported into a Grafana instance with a differently-named datasource. Verify this tradeoff is acceptable.OrderMetrics.setOrdersByStateAPI change. Changed fromrecordOrdersByState(String state, int count)(internally manages gauge lifecycle) tosetOrdersByState(String state, AtomicInteger gauge)(caller manages theAtomicInteger). This pushes complexity to the caller. Verify the simpler API is preferred.prometheus.ymltargets (order-service:8081, etc.) won't resolve until individual microservices are added to docker-compose. Prometheus will show these targets as DOWN. Confirm this is intentional (infrastructure-ready ahead of service deployment).Suggested test plan:
docker-compose up prometheus grafanaand verify both containers startlocalhost:3000(admin/admin), confirm the Prometheus datasource is connected and all 4 dashboards load without errors./gradlew :shared-libraries:ftgo-observability:compileJavasucceeds/actuator/prometheuson port 8081 and verify metrics are emitted withapplicationandenvtagsNotes
ftgo-commoncompilation errors (javax.persistence,commons-langmissing) — unrelated to this PR. These checks are not marked as required.ftgo-end-to-end-testsbuild failure (eventuate-util-testnot found) is also pre-existing.application.ymlfiles now have bothserviceandapplicationmetric tags; this is intentional for flexibility in Prometheus queries.Link to Devin session: https://app.devin.ai/sessions/edf9650205c147cd891d03308b7d8cc0
Requested by: @mbatchelor81