Thundercloud12 opened a new pull request, #9160:
URL: https://github.com/apache/devlake/pull/9160
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
### Summary
This PR introduces a new **Grafana IRM (Incident Response & Management)**
plugin to Apache DevLake, enabling ingestion of Grafana Cloud Incident data
into DevLake's standardized domain layer (`issues`, `issue_labels`,
`issue_assignees`, `boards`, and `board_issues`) for tracking incident metrics
and correlating with DORA metrics (Change Failure Rate and MTTR).
#### Key Components
1. **Backend Plugin (`backend/plugins/grafana_irm`)**
* **Data Layer:**
* Raw layer: `_raw_grafana_irm_incidents`
* Tool layer: `_tool_grafana_irm_incidents`,
`_tool_grafana_irm_incident_labels`, `_tool_grafana_irm_incident_assignments`,
and scopes/connections.
* Domain layer: maps incidents to domain `Issue` (`type = INCIDENT`),
`IssueLabel`, `IssueAssignee`, and domain `Board` / `BoardIssue`.
* **Collection Pattern:**
* Incremental incident collection utilizing
`helper.NewFinalizableApiCollector`.
* Handles both date-range query collection
(`IncidentsService.QueryIncidents`) and active/unfinished incident refreshes in
a single subtask.
* **API & Scope Management:**
* Full CRUD for connections, credential validation via service account
tokens, scope APIs, and single-scope remote API picker (`remote_api.go`).
* Resilient error handling for connection testing, including DNS
errors, invalid URLs, HTTP 401/403/404 responses, and network timeouts with
friendly error messages.
* **Database Migration:**
* Initial schema migration (`20260918_add_init_tables.go`) registered
in `register.go`.
* Registered in `plugins/table_info_test.go` and schema validation
tests.
2. **Config UI Integration (`config-ui`)**
* Registered `grafana_irm` in the Config UI plugin registry.
* Added a connection form supporting Grafana Cloud stack endpoint,
Service Account tokens, proxy, and rate limits.
* Bundled the official Grafana SVG icon and linked official Grafana IRM
documentation.
3. **Dashboards (`grafana/dashboards`)**
* Added a dedicated Grafana IRM dashboard JSON (`grafana-irm.json`, plus
MySQL and PostgreSQL variants) displaying incident trends, MTTR, severity
breakdown, and active incident tracking.
4. **Testing**
* E2E dataflow tests (`incident_test.go`) with CSV fixtures verifying raw
→ tool → domain conversion.
* Unit tests covering query generation, extraction, remote scopes, and
connection test error cases (`connection_api_test.go`).
### Screenshots
https://github.com/user-attachments/assets/88a1a6f0-bf09-44bf-9cc0-6119faa0b190
### Other Information
* **Auth Model:** Authenticates using Grafana Cloud Service Account tokens
(`Authorization: Bearer <token>`).
* **Endpoint Format:** Accepts standard Grafana Cloud stack base URLs (e.g.,
`https://<stack>.grafana.net/`).
* Follows existing incident plugin conventions (`pagerduty`, `incidentio`,
`opsgenie`).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]