Skip to content

[Bug] Equal response times normalize to NaN #3813

Description

@anjupathak03

Describe the bug

When two or more checks all have the same response time, both normalization helpers return NaN for the chart value.

NormalizeData and NormalizeDataUptimeDetails calculate the p0 and p95 anchors and then divide by max - min. For a constant series those anchors are equal, so the range has zero width. When the result is serialized to JSON, NaN becomes null, leaving chart consumers without a numeric value.

The existing unit tests already characterize this as a known edge case, but intentionally expect the broken result.

To reproduce

NormalizeData(
  [{ responseTime: 50 }, { responseTime: 50 }],
  10,
  100
);

Both normalized responseTime values are NaN.

The same happens to avgResponseTime in NormalizeDataUptimeDetails.

Expected behavior

Constant response-time series should produce a finite chart value while retaining the real value in originalResponseTime or originalAvgResponseTime.

Mapping a zero-width series to rangeMin is consistent with how the minimum anchor is normally mapped and keeps the bars visible without inventing relative variation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions