Important: This news article covers an old version of Javalin (v5.2.0). The current version is v6.1.3.
See the documentation page for up-to-date information.

Micrometer is back (baby)!

The Micrometer team has managed to get Micrometer ready for Jetty 11, which allows us to bring back the plugin. This is distributed in the javalin-micrometer artifact.

The plugin can be enabled like this:

  • Java
  • Kotlin
Javalin.create(config -> {
    config.plugins.register(
        MicrometerPlugin.create(metrics -> {
            metrics.registry = meterRegistry;
            metrics.tags = Tags.empty();
            metrics.tagExceptionName = true;
            metrics.tagRedirectPaths = tagRedirectPaths;
            metrics.tagNotFoundMappedPaths = tagNotFoundMappedPaths;
        })
    );
});
Javalin.create { config ->
    config.plugins.register(
        MicrometerPlugin.create { metrics ->
            metrics.registry = meterRegistry
            metrics.tags = Tags.empty()
            metrics.tagExceptionName = true
            metrics.tagRedirectPaths = tagRedirectPaths
            metrics.tagNotFoundMappedPaths = tagNotFoundMappedPaths
        }
    )
}

SseClient features and fixes

We’ve added a terminated() function to the SseClient. This function will return true if the connection has been terminated, either by the user calling SseClient#close(), or by the remote client disconnecting.

We’ve also fixed a bug where SseClient#close was called every time SseClient#send was called on a closed connection.

Other changes since 5.1.0

  • Fix welcome files for static files when pre-compression is enabled
  • Support order in submitTask API (request lifecycle)
  • Support “prefer405over404” option in CorsPlugin
  • Use 127.0.0.1 instead of localhost in testtools
  • Use latest version of logback
  • Include brotli in javalin-bundle
  • Expose fields and methods from ConcurrencyUtil
  • Support plugins initialization in Javalin#updateConfig
  • Move “Created but not started” to JavalinLogger#startup
  • Fix issue with double compression when pre-compression enabled