Thundercloud12 opened a new pull request, #9173:
URL: https://github.com/apache/devlake/pull/9173

   <!--
       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 restores PostgreSQL dashboard parity for the Cursor plugin and 
multi-tool AI dashboards, resolving omissions introduced when the Cursor plugin 
was contributed in PR #9017.
   
   #### Key Changes
   
   1. **Added PostgreSQL Cursor Usage Dashboard**
      - Generated `grafana/dashboards/postgresql/cursor-usage.json` (21 panels) 
with UID `cursor_usage-pg`.
      - Converted all SQL queries to PostgreSQL dialect:
        - `DATE_TRUNC`
        - ISO weekday arithmetic
        - `CAST(... AS NUMERIC)`
        - `COALESCE`
        - `is_active = TRUE`
        - `is_removed = FALSE`
   
   2. **Synchronized Multi-AI Tool Comparison Dashboard**
      - Updated `grafana/dashboards/postgresql/multi-ai-comparison.json` title 
to:
        `Multi-AI Tool Comparison: Copilot vs Kiro vs Cursor`
      - Added Panel 13: **Cursor: Tab Completions** (shown vs. accepted).
      - Added Cursor telemetry queries to:
        - **Weekly Active Users Comparison** (Panel 3)
        - **LOC Accepted / Returned Lines** (Panel 21)
        - **Acceptance Rate Availability** (Panel 22)
      - Added `cursor_connection_id` and `cursor_scope_id` template variables 
and tags.
   
   3. **Synchronized AI Cost-Efficiency Dashboard**
      - Synchronized `grafana/dashboards/postgresql/ai-cost-efficiency.json` 
with the 7 missing Cursor cost/spend panels, increasing the panel count from 10 
to 17:
        - *Cursor Cost Efficiency* (row)
        - *Cursor Total Spend* (stat)
        - *Cursor $ per PR* (stat)
        - *Cursor $ per Deployment* (stat)
        - *Cursor $ per Issue Resolved* (stat)
        - *Cursor $ per Merged PR (Weekly)* (timeseries)
        - *Cursor $ per Deployment (Weekly)* (timeseries)
      - Added `cursor_connection_id` and `cursor_scope_id` template variables 
and a Cursor navigation link.
   
   4. **Updated Dashboard Converter Script (`convert-mysql-to-postgresql.py`)**
      - Updated datasource conversion to output Grafana 13 format:
        ```json
        {
          "type": "grafana-postgresql-datasource",
          "uid": "devlake-postgres-api"
        }
        ```
      - Added keyword protection in `quote_select_columns` for SQL constants:
        - `NULL`
        - `TRUE`
        - `FALSE`
        - `CURRENT_DATE`
        - `CURRENT_TIMESTAMP`
      - This prevents bare SQL literals in `SELECT` lists from being 
incorrectly quoted as column identifiers (for example, preventing `"NULL"`).
   
   ### Does this close any open issues?
   
   Closes #9171 
   
   
   
   ### Other Information
   
   - **Root Cause:** PR #9017 added Cursor dashboards for MySQL but did not 
generate PostgreSQL counterparts. Because DevLake's CI validates Go migrations 
but lacks dashboard parity checks between `grafana/dashboards/mysql/` and 
`grafana/dashboards/postgresql/`, this regression went undetected.
   
   - **Verification:**
     - Validated all 3 dashboards with `python3 -m json.tool`.
     - Confirmed all queries and template variables target 
`devlake-postgres-api`.
     - Verified panel counts match between MySQL and PostgreSQL:
       - `cursor-usage.json`: 21 panels
       - `multi-ai-comparison.json`: 10 panels
       - `ai-cost-efficiency.json`: 17 panels
     - Confirmed zero occurrences of MySQL-specific syntax:
       - `DATE_SUB`
       - `WEEKDAY`
       - Backticks
       - `"NULL"`


-- 
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]

Reply via email to