feat: add independent spread metric filters
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
import type {
|
||||
SpreadInfoConfig,
|
||||
SpreadInfoMetrics,
|
||||
SpreadMetricFilterRule,
|
||||
SpreadMetricThresholds
|
||||
SpreadMetricFilterRule
|
||||
} from "./types";
|
||||
|
||||
interface FetchResponseLike {
|
||||
@@ -205,21 +204,6 @@ export function mapSpreadInfoResponse(
|
||||
};
|
||||
}
|
||||
|
||||
export function matchesSpreadThresholds(
|
||||
metrics: MappedSpreadInfoResponse,
|
||||
thresholds: SpreadMetricThresholds
|
||||
): boolean {
|
||||
return Object.entries(thresholds).every(([key, threshold]) => {
|
||||
if (typeof threshold !== "number" || !Number.isFinite(threshold)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const metricValue = metrics[key as keyof SpreadMetricThresholds];
|
||||
const numericValue = readDisplayNumber(metricValue);
|
||||
return numericValue !== null && numericValue >= threshold;
|
||||
});
|
||||
}
|
||||
|
||||
export function normalizeSpreadInfoConfig(
|
||||
config: SpreadInfoConfig
|
||||
): SpreadInfoConfig {
|
||||
|
||||
Reference in New Issue
Block a user