Repository: ktorio/ktor
File: ktor-server/ktor-server-plugins/ktor-server-metrics-micrometer/jvm/src/io/ktor/server/metrics/micrometer/MicrometerMetrics.kt (Kotlin)

Code before:
    /**
     * Configures the histogram and/or percentiles for all request timers.
     * By default, 50%, 90% , 95% and 99% percentiles are configured.
     * If your backend supports server side histograms, you should enable these instead
     * with [DistributionStatisticConfig.Builder.percentilesHistogram] as client side percentiles cannot be aggregated.
     *
     * [Report a problem](https://ktor.io/feedback/?fqname=io.ktor.server.metrics.micrometer.MicrometerMetricsConfig.distributionStatisticConfig)
     *
     * @see [MicrometerMetrics]
     */
    public var distributionStatisticConfig: DistributionStatisticConfig =
        DistributionStatisticConfig.Builder().percentiles(0.5, 0.9, 0.95, 0.99).build()

    internal var timerBuilder: Timer.Builder.(ApplicationCall, Throwable?) -> Unit = { _, _ -> }

    /**
     * Configures micrometer timers.
     * Can be used to customize tags for each timer, configure individual SLAs, and so on.
     *
     * [Report a problem](https://ktor.io/feedback/?fqname=io.ktor.server.metrics.micrometer.MicrometerMetricsConfig.timers)
     */
    public fun timers(block: Timer.Builder.(ApplicationCall, Throwable?) -> Unit) {
        timerBuilder = block
    }

    internal var transformRoute: RoutingNode.() -> String = { path }

    /**
     * Configures mapping function for the route label string of the [CallMeasure].
     * Defaults to [RoutingNode.path].
     *
     * **Examples:**
     *
     * Use the toString() function of the RoutingNode:
     * ```kotlin
     * transformRoute {
     *    toString()
     * }
     * ```
     *
     * Remove a prefix from the path:
     * ```kotlin
     * transformRoute {
     *     path.removePrefix("/path/prefix")
     * }
     * ```
     *
     * [Report a problem](https://ktor.io/feedback/?fqname=io.ktor.server.metrics.micrometer.MicrometerMetricsConfig.transformRoute)
     */
    public fun transformRoute(block : RoutingNode.() -> String) {
        transformRoute = block

Review comment (suggestion):
Note: We should mark this issue as "impactful change" as it requires migration for those who relies on the old behavior

Code after:
    /**
     * Configures the histogram and/or percentiles for all request timers.
     * By default, 50%, 90% , 95% and 99% percentiles are configured.
     * If your backend supports server side histograms, you should enable these instead
     * with [DistributionStatisticConfig.Builder.percentilesHistogram] as client side percentiles cannot be aggregated.
     *
     * [Report a problem](https://ktor.io/feedback/?fqname=io.ktor.server.metrics.micrometer.MicrometerMetricsConfig.distributionStatisticConfig)
     *
     * @see [MicrometerMetrics]
     */
    public var distributionStatisticConfig: DistributionStatisticConfig =
        DistributionStatisticConfig.Builder().percentiles(0.5, 0.9, 0.95, 0.99).build()

    internal var timerBuilder: Timer.Builder.(ApplicationCall, Throwable?) -> Unit = { _, _ -> }

    /**
     * Configures micrometer timers.
     * Can be used to customize tags for each timer, configure individual SLAs, and so on.
     *
     * [Report a problem](https://ktor.io/feedback/?fqname=io.ktor.server.metrics.micrometer.MicrometerMetricsConfig.timers)
     */
    public fun timers(block: Timer.Builder.(ApplicationCall, Throwable?) -> Unit) {
        timerBuilder = block
    }

    internal var transformRoute: (RoutingNode) -> String = { it.path }

    /**
     * Configures mapping function for the route label string of the [CallMeasure].
     * Defaults to [RoutingNode.path].
     *
     * **Examples:**
     *
     * Use the toString() function of the RoutingNode:
     * ```kotlin
     * transformRoute {
     *    it.toString()
     * }
     * ```
     *
     * Remove a prefix from the path:
     * ```kotlin
     * transformRoute {
     *     it.path.removePrefix("/path/prefix")
     * }
     * ```
     *
     * [Report a problem](https://ktor.io/feedback/?fqname=io.ktor.server.metrics.micrometer.MicrometerMetricsConfig.transformRoute)
     */
    public fun transformRoute(block: (RoutingNode) -> String) {
        transformRoute = block