Feature/ab#32049 prometheus#2419
Open
JamesPasta wants to merge 7 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds Prometheus-based monitoring and alerting support to the Unity GrantManager web app, including metrics exposure, exception/error counters, and an Alertmanager webhook endpoint that forwards alerts to Teams.
Changes:
- Added Prometheus (
/metrics) instrumentation and custom counters for exceptions and Serilog error-level logs. - Added an anonymous Alertmanager webhook API that summarizes firing alerts and posts them to Teams.
- Added local (docker-compose) and OpenShift Prometheus/Alertmanager configuration manifests for scraping and alert rules.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| applications/Unity.GrantManager/src/Unity.GrantManager.Web/Unity.GrantManager.Web.csproj | Adds Prometheus and OpenTelemetry NuGet dependencies. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Web/Program.cs | Configures OpenTelemetry instrumentation and wires Serilog sink + exception-counting middleware. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Web/Middleware/ExceptionCounterMiddleware.cs | New middleware to count exceptions and notify Teams on unhandled exceptions. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Web/Middleware/ErrorCountingLoggerProvider.cs | New Serilog sink that increments a Prometheus counter for error/critical logs. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Web/GrantManagerWebModule.cs | Exposes Prometheus HTTP metrics middleware and maps /metrics. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Web/Controllers/Monitoring/AlertWebhookController.cs | New Alertmanager webhook endpoint that forwards alert summaries to Teams. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Web/Controllers/Monitoring/AlertPayload.cs | Defines the Alertmanager webhook payload DTOs. |
| applications/Unity.GrantManager/scripts/prometheus/prometheus.yml | Local Prometheus scrape config and alertmanager target configuration. |
| applications/Unity.GrantManager/scripts/prometheus/alertmanager.yml | Local Alertmanager routing to the app webhook. |
| applications/Unity.GrantManager/scripts/prometheus/alert-rules.yml | Local Prometheus alert rules for exception-rate detection. |
| applications/Unity.GrantManager/scripts/openshift/service-monitor.yaml | ServiceMonitor CRD to scrape /metrics in OpenShift. |
| applications/Unity.GrantManager/scripts/openshift/prometheus-rule.yaml | PrometheusRule CRD for exception alerts in OpenShift. |
| applications/Unity.GrantManager/scripts/openshift/alertmanager-config.yaml | AlertmanagerConfig CRD routing cluster alerts to the app webhook. |
| applications/Unity.GrantManager/docker-compose.yml | Adds local Prometheus and Alertmanager services for dev/test runs. |
Comment on lines
+14
to
+18
| [ApiController] | ||
| [Route("api/monitoring")] | ||
| [AllowAnonymous] | ||
| [IgnoreAntiforgeryToken] | ||
| public class AlertWebhookController( |
Comment on lines
+25
to
+33
| [HttpPost("alert")] | ||
| public async Task<IActionResult> ProcessAlert([FromBody] AlertManagerPayload? payload) | ||
| { | ||
| if (payload is null || !ModelState.IsValid || payload.Alerts.Count == 0) | ||
| { | ||
| return BadRequest(); | ||
| } | ||
|
|
||
| try |
Comment on lines
+14
to
+20
| [ApiController] | ||
| [Route("api/monitoring")] | ||
| [AllowAnonymous] | ||
| [IgnoreAntiforgeryToken] | ||
| public class AlertWebhookController( | ||
| INotificationsAppService notificationsAppService, | ||
| ILogger<AlertWebhookController> logger) : AbpController |
|
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.



No description provided.