Wildfly 16.0.0 with Microprofile Metrics 2.0.0

Wildfly Server is supporting the Eclipse Microprofile Metric API since version 14.0.0 . Within the Imixs-Workflow Project we started since version 5.0.0 to support Microprofile 2.0.

One of the features is to monitor the behavior of the Imixs-Worklfow engine by adding application metrics for the DocumentService and the WorkflowService. As a result you can monitor metrics in the prometheus format.

The following is a short example of the metric output:

# HELP application_workitems_total Imixs-Workflow count procssed workitems
# TYPE application_workitems_total counter
application_workitems_total{event="20",modelversion="1.1",task="1200",type="workitem",workflowgroup="Ticket",workflowstatus="in Progress"} 1.0
application_workitems_total{event="20",modelversion="1.1",task="1000",type="workitem",workflowgroup="Ticket",workflowstatus="New Ticket"} 1.0
application_workitems_total{event="10",modelversion="1.1",task="1200",type="workitem",workflowgroup="Ticket",workflowstatus="in Progress"} 4.0
application_documents_total{method="save"} 3.0
# HELP application_documents_total Imixs-Workflow count documents
# TYPE application_documents_total counter
application_documents_total{method="load"} 16.0

As you can see in this example, we use the Tags to create different instances of the metric ‘workitems_total’. This feature is supported since Version 2.0.0 of Microprofile Metrics. (See also my last Blog)

To run Imixs-Worflow in its lates version you need Microprfile Metric API 2.0.0 which is not part of the current Wildfly release 16.0.0. But its easy to add the API to your Wildfly Server.

Update the Microprofile Modules in Wildfly

To get support of Microsprofile Metric API 2.0.0 in Wildfly you need to udpate the following libraries:

  • smallrye-metrics-2.0-1.0.1-SNAPSHOT.jar
  • microprofile-metrics-api-2.0.0.jar

In the moment smallrye-metrics-2.0 is just available as a Snapshot because it is still under development. So I downloaded the sources from Github and build the jar file. The microprofile-metrics-api-2.0.0 is official released.

You need to add the new files into the corresponding module directories of your wildfly server:

  • /modules/system/layers/base/io/smallrye/metrics/main
  • /modules/system/layers/base/org/eclipse/microprofile/metrics/api/main

and finally update the module.xml files with your updates jar versions:

module.xml for microprofile metric module:

<module name="org.eclipse.microprofile.metrics.api" xmlns="urn:jboss:module:1.8">
    <resources>
        <resource-root path="microprofile-metrics-api-2.0.0.jar"/>
    </resources>
    <dependencies>
        <module name="javax.enterprise.api"/>
        <module name="org.eclipse.microprofile.config.api"/>
        <module name="org.jboss.weld.core"/>
        <module name="org.jboss.weld.spi"/>
    </dependencies>
</module>

module.xml for smallrye.metrics module:

<module name="io.smallrye.metrics" xmlns="urn:jboss:module:1.8">
    <properties>
        <property name="jboss.api" value="private"/>
    </properties>
    <resources>
        <resource-root path="smallrye-metrics-2.0-1.0.1-SNAPSHOT.jar"/>
    </resources>
    <dependencies>
        <module name="javax.api"/>
        <module name="org.eclipse.microprofile.config.api"/>
        <module name="org.eclipse.microprofile.metrics.api"/>
        <module name="org.jboss.logging"/>
        <module name="javax.enterprise.api"/>
        <module name="javax.annotation.api"/>
        <module name="javax.json.api"/>
        <module name="org.jboss.weld.core"/>
        <module name="org.jboss.weld.spi"/>
    </dependencies>
</module>

That’s it! Now when you start Wildfly 16.0.0 and it will support Microprofile Metrics 2.0.0. I hope this will soon become part of Wildfly version 17.0.0 or a 16.0.1 release.

I also build a custom Docker Image with Wilfly 16.0.0 and Microprofile Metrics 2.0.0. You can download the image from Docker-Hub or you can look into the code at Github.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.