Add credits-per-merged-MR ratio metric to the DuoWorkflows engine

Adds a creditsPerMergedMrRatio metric to the DuoWorkflows analytics engine: total credits consumed divided by total merged MRs (merge requests created by Duo Agent Platform sessions that were later merged). The numerator intentionally includes credits from all activities, including ones that never produce an MR, such as Chat, so the number reads as total spend per merged change. This feeds the "Cost per merged change" tile on the DAP Impact Overview tab.

Built on the ratio metric type from !256384 (merged) (merged). GLQL and dashboard usage come separately, in the glql compiler MR (glql!533 (merged)) and the dashboard tile MR (!256890 (merged)).

Three new engine specs cover ratio-of-sums behavior, NULL for buckets with no merged MRs, and authorization stripping. RuboCop is clean, and the metric is verified against seeded ClickHouse data in GDK.

Part of #630202.

Testing

Run as a user with read_agent_artifacts on a group with DuoWorkflows ClickHouse data:

query {
  group(fullPath: "<group-path>") {
    analytics {
      duoWorkflows(createdAtFrom: "2026-09-01T00:00:00Z", createdAtTo: "2026-09-14T23:59:00Z") {
        aggregated {
          nodes {
            creditsPerMergedMrRatio
            creditsUsed { sum }
            mergedMrCount { sum }
          }
        }
      }
    }
  }
}
Edited by Abhinaba Ghosh

Merge request reports

Loading
Loading