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. Next, 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!
Important links:
- Official changelog on GitHub
- Current API specification document as pdf
- Release information on GitHub
- In-depth article for MicroProfile Metrics 2.0
Breaking changes:
- Refactoring of Counters, as the old
@Counted
was 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)
Metadata
is now immutable and built via aMetadataBuilder
.- 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 are modified such that the ‘tags' attribute is a list of nested lists that 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
@InterceptorBinding
annotation fromorg.eclipse.microprofile.metrics.annotation.Metric
- Tag key names for labels are restricted to match the regex
[a-zA-Z_][a-zA-Z0-9_]*
. MetricFilter
modified to filter with MetricID instead of the name- Tag values defined through
MP_METRICS_TAGS
must escape equal signs=
and commas, with a backslash\
.
Changes with Health Check 2.0: Kubernetes here we come!
Important links:
- Current API specification document as pdf
- All changes with this release
- Release information on GitHub
- An in-deptharticle about MicroProfile Health Check 2.0
Breaking changes:
- The message body of Health check response is modified, outcome and state is replaced by status
- Introduction of Health checks for
@Liveness
and@Readiness
on/health/ready
and/health/live
endpoints (nice for Kubernetes)
Other important changes:
- Deprecation of
@Health
annotation - 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!
Important links:
- Current API specification document as pdf
- Release information on GitHub
- Online documentation
- An in-deptharticle about MicroProfile Rest Client 1.3
Important changes:
- Spec-defined SSL support via new
RestClientBuilder
methods and MP Config properties. - Allow client proxies to be cast to
Closeable
/AutoCloseable
. - Simpler configuration using
configKeys
. - Defined
application/json
to be the defaultMediaType
if none is specified in@Produces/@Consumes
.
In addition and if you need more details, you can visit the official announcement post on the MicroProfile page.
Furthermore, 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,
Philip