Skip to content

feat: implement DORA metric calculation engine (DF, LT, MTTR, CFR) [RR-59]#15

Open
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin/1777000129-dora-metric-engine
Open

feat: implement DORA metric calculation engine (DF, LT, MTTR, CFR) [RR-59]#15
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin/1777000129-dora-metric-engine

Conversation

@devin-ai-integration
Copy link
Copy Markdown

Summary

Adds a new dora feature module with a DoraMetricsService that transforms raw pipeline events (deploys, commits, incidents) into the four DORA metrics:

  • Deployment Frequency (DF): Counts successful deploys over a period, computes deploys/day
  • Lead Time (LT): Measures time from earliest commit to its associated successful deploy (average + median)
  • Mean Time to Restore (MTTR): Measures incident open→resolve duration for resolved incidents (average + median)
  • Change Failure Rate (CFR): Ratio of failed deploys to total deploys

Each metric is rated elite | high | medium | low based on hardcoded thresholds. A calculateAll() convenience method computes all four at once.

This is calculation logic only — no API integration, no UI, no route. The service is registered as providedIn: 'root' but has no consumers yet.

36 Vitest unit tests cover all calculations, rating thresholds, edge cases (empty inputs, zero periods, all-failed/all-success), and median computation for odd/even counts.

Review & Testing Checklist for Human

  • Verify rating thresholds match your DORA benchmark expectations. The thresholds are hardcoded in private rate* methods (e.g., elite DF ≥ 1/day, elite LT ≤ 24h, elite MTTR ≤ 1h, elite CFR ≤ 5%). These are not configurable — confirm they align with team standards.
  • Confirm lead time methodology. Lead time is measured from the earliest commit linked to a deploy. If your definition differs (e.g., PR merge time, or per-commit rather than per-deploy), this needs adjustment.
  • Assess scope sufficiency for RR-59. This PR delivers pure calculation logic with no data source integration. Confirm whether the ticket expects only the engine, or also an API/UI layer.
  • Note: no input validation. Timestamps are parsed via new Date(string) with no format validation; invalid timestamps would produce NaN results silently. The service field on events is present in the model but not used for filtering — all events are processed together.

Notes

  • Tests instantiate the service directly (new DoraMetricsService()) rather than through Angular TestBed, since the service has zero Angular DI dependencies. This avoids the pre-existing zone.js missing-dependency issue in the test setup.
  • The service field on event models is available for future per-service filtering but is not currently used in calculations.

Link to Devin session: https://app.devin.ai/sessions/04b630c9eed34b9281b656b35421e447

Add calculation logic that transforms raw pipeline events into the four
DORA metrics:
- Deployment Frequency from successful deploy count over a period
- Lead Time from first commit timestamp to deploy timestamp
- Mean Time to Restore from incident open to resolve timestamps
- Change Failure Rate from failed deploys / total deploys

Each metric includes a rating (elite/high/medium/low) based on DORA
research benchmarks. Includes 36 unit tests covering all calculations,
edge cases, and rating thresholds.

Resolves: RR-59
Co-Authored-By: unknown <>
@devin-ai-integration
Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants