class NamedCacheMetrics {

    public static Sensor hitRatioSensor(final StreamsMetricsImpl streamsMetrics,
                                        final String threadId,
                                        final String taskName,
                                        final String storeName) {

        final Sensor hitRatioSensor;
        final String hitRatioName;
        if (streamsMetrics.version() == FROM_0100_TO_24) {
            hitRatioName = HIT_RATIO_0100_TO_24;
            final Sensor taskLevelHitRatioSensor = streamsMetrics.taskLevelSensor(
                threadId,
                taskName,
                hitRatioName,
                Sensor.RecordingLevel.DEBUG
            );
            addAvgAndMinAndMaxToSensor(
                taskLevelHitRatioSensor,
                CACHE_LEVEL_GROUP,
                streamsMetrics.cacheLevelTagMap(threadId, taskName, ROLLUP_VALUE),
                hitRatioName,
                HIT_RATIO_AVG_DESCRIPTION,
                HIT_RATIO_MIN_DESCRIPTION,
                HIT_RATIO_MAX_DESCRIPTION
            );
            hitRatioSensor = streamsMetrics.cacheLevelSensor(
                threadId,
                taskName,
                storeName,
                hitRatioName,
                Sensor.RecordingLevel.DEBUG,
                taskLevelHitRatioSensor
            );
        } else {
            hitRatioName = HIT_RATIO;
            hitRatioSensor = streamsMetrics.cacheLevelSensor(
                threadId,
                taskName,
                storeName,
                hitRatioName,
                Sensor.RecordingLevel.DEBUG
            );
        }
        addAvgAndMinAndMaxToSensor(
            hitRatioSensor,
            CACHE_LEVEL_GROUP,
            streamsMetrics.cacheLevelTagMap(threadId, taskName, storeName),
            hitRatioName,
            HIT_RATIO_AVG_DESCRIPTION,
            HIT_RATIO_MIN_DESCRIPTION,
            HIT_RATIO_MAX_DESCRIPTION
        );
        return hitRatioSensor;
    }

    private  NamedCacheMetrics();

}