public static Granularity granularityFromPointsInInterval ( String tenantid , long from , long to , int points , String algorithm , long assumedIntervalMillis , Clock ttlComparisonClock ) { if ( from >= to ) { throw new RuntimeException ( "Invalid interval specified for fromPointsInInterval" ) ; } double requestedDuration = to - from ; if ( algorithm . startsWith ( "GEOMETRIC" ) ) return granularityFromPointsGeometric ( tenantid , from , to , requestedDuration , points , assumedIntervalMillis , ttlComparisonClock ) ; else if ( algorithm . startsWith ( "LINEAR" ) ) return granularityFromPointsLinear ( requestedDuration , points , assumedIntervalMillis ) ; else if ( algorithm . startsWith ( "LESSTHANEQUAL" ) ) return granularityFromPointsLessThanEqual ( requestedDuration , points , assumedIntervalMillis ) ; return granularityFromPointsGeometric ( tenantid , from , to , requestedDuration , points , assumedIntervalMillis , ttlComparisonClock ) ; }
Return granularity that maps most closely to requested number of points based on provided selection algorithm