To configure the Liberty server to run an application that is enabled for the
MicroProfile metrics API, you must set the feature for the server.
Documentation for the MicroProfile Metrics
feature versions 2.0 and later is available on the Open Liberty website.
Procedure
-
Configure the feature. Add the
mpMetrics-1.0
to the feature manager in the
server.xml file.
The mpMetrics-1.0
feature requires also that you secure the REST API. The
following example illustrates a basic security setup. MicroProfile metrics use the default keystore
to secure the endpoint.
<featureManager>
<feature>mpMetrics-1.0</feature>
</featureManager>
<quickStartSecurity userName="theUser" userPassword="thePassword"/>
<keyStore id="defaultKeyStore" password="Liberty"/>
Liberty can be configured to support the MicroProfile 1.0 features by setting
microProfile-1.0
in the server.xml file. However, the
MicroProfile metrics API was produced after the MicroProfile 1.0 release and is not made available
using that feature.
-
Use the org.eclipse.microprofile.metrics Java package, included in the
mpMetrics-1.0
feature, to instrument your application.