With the MicroProfile release cycle of three releases every year in February, June, and October we got MicroProfile 3.0 on June 11th, 2019. This version is based on MicroProfile 2.2 and updates the Rest Client, Metrics, and Health Check API which I’ll show you in this blog post today.
The current API landscape for MicroProfile 3.0 looks like the following:
As you can see in this image, there were no new APIs added with this release. The Microprofile Rest Client API was updated from 1.2 to 1.3 with no breaking change included. The Metrics API got a new major version update from 1.1 to 2.0 introducing some breaking changes, which you’ll learn about. The same is true for the Health Check API which is now available with version 2.0 and also introduces breaking API changes.
Changes with Metrics 2.0: Counters ftw!
- Refactoring of Counters, as the old
@Countedwas misleading in practice (you can find migration hints in the API specification document)
- Removed deprecated
org.eclipse.microprofile.metrics.MetricRegistry.register(String name, Metric, Metadata)
Metadatais now immutable and built via a
- Metrics are now uniquely identified by a MetricID (a combination of the metric’s name and tags).
- JSON output format for GET requests now appends tags along with the metric in
metricName;tag=value;tag=value format. JSON format for OPTIONS requests has been modified such that the ‘tags’ attribute is a list of nested lists which holds tags from different metrics that are associated with the metadata. The default value of the reusable attribute for metric objects created programmatically (not via annotations) is now true
Some base metrics’ names have changed to follow the convention of ending the name of accumulating counters with total
Other important changes:
- Removed unnecessary
- Tag key names for labels are restricted to match the regex
MetricFiltermodified to filter with MetricID instead of the name
- Tag values defined through
MP_METRICS_TAGSmust escape equal signs
=and commas, with a backslash
Changes with Health Check 2.0: Kubernetes here we come!
- The message body of Health check response was modified, outcome and state were replaced by status
- Introduction of Health checks for
/health/liveendpoints (nice for Kubernetes)
Other important changes:
- Deprecation of
- Correction and enhancement of response JSON format
- TCK enhancement and cleanup
- Enhance examples in spec (introduce Health check procedures producers)
Changes with Rest Client 1.3: Improved config and security!
- Spec-defined SSL support via new
RestClientBuildermethods and MP Config properties.
- Allow client proxies to be cast to
- Simpler configuration using
application/jsonto be the default
MediaTypeif none is specified in
For more details, you can visit the official announcement post on the MicroProfile page.
I’m planning to give you code-based examples for MicroProfile 3.0 once the first application server supports it (for Payara this will be version 5.193). Stay tuned!
Have fun with MicroProfile 3.0,