Skip to content

[Bug]: MigrationMetrics records version span only on success, not failure #218

@Splatcrafter

Description

@Splatcrafter

AI REVIEWED

Module: spring-boot-starter
File: spring/metrics/MigrationMetrics.java (~line 270)
Severity: Medium

Summary

recordSuccess() records the version span metric, but recordFailure() does not. This creates inconsistent metrics — you can't correlate failure rates with migration span size.

Suggested Fix

Record version span in both success and failure paths:

public void recordFailure(String domain, int fromVersion, int toVersion, Throwable error) {
    final int span = Math.abs(toVersion - fromVersion);
    getOrCreateVersionSpan(domain).record(span);
    getOrCreateFailureCounter(domain, classifyError(error)).increment();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions