Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Monitor Fault Tolerance in Your Microservices in the Liberty July Beta

DZone's Guide to

Monitor Fault Tolerance in Your Microservices in the Liberty July Beta

Learn about the updates in the WebSphere Liberty beta and how you can use it to monitor the fault tolerance of your Java microservices.

· Microservices Zone ·
Free Resource

Learn why microservices are breaking traditional APM tools that were built for monoliths.

Get metrics about the fault tolerance of your Java microservices with MicroProfile Metrics integration with MicroProfile Fault Tolerance 1.1 in the July 2018 beta of WebSphere Liberty.

Thanks to your support for our regular beta programme, we are able to release new Liberty features every few months. We recently released WebSphere Liberty 18.0.0.2, built on Open Liberty 18.0.0.2.

Look out for more betas over the coming months. If you just can't wait, take a look at the daily builds of Open Liberty. Follow Open Liberty happenings on @OpenLibertyIO.

What's New in This Beta?

Integrated Metrics and Disabling Annotations With MicroProfile Fault Tolerance 1.1

MicroProfile Fault Tolerance enables you to easily add smart error handling to your methods using annotations. For example, you can indicate that a method should be retried if it fails or should be stopped if it takes too long.

Major changes in version 1.1 include:

  • Ability to disable individual Fault Tolerance annotations using config
  • Integration with MicroProfile Metrics

New in 1.1 is the ability to disable individual Fault Tolerance annotations using the MicroProfile Config feature. For example, if you have a method MyClient.methodA() which is annotated with @CircuitBreaker, you can disable the circuit breaker by adding this configuration entry:

com.acme.test.MyClient/methodA/CircuitBreaker/enabled=false


The integration with MicroProfile Metrics means that if you use mpFaultTolerance-1.1 and mpMetrics-1.1 together, you'll automatically get metrics for each of the methods annotated with a Fault Tolerance annotation. This allows you to see when your application is having problems, even as it's mitigating those problems to keep things running as smoothly as possible for your users.

The following graph shows the average number of retries per request to a method annotated with @Retry. Even though the failures are masked by @Retry, the failure count is still visible in the metrics, allowing operators to be alerted and allowing them to see when the problem started. These methods can be gathered and graphed using Prometheus; for example:

To enable Fault Tolerance metrics with annotations, include the following features in the server.xml (you don't need to specify the MicroProfile Config feature because it is automatically loaded as a dependency by mpFaultTolerance-1.1):

<featureManager>
  <feature>mpFaultTolerance-1.1</feature>
  <feature>mpMetrics-1.1</feature>
</featureManager>


Example use of fault tolerance annotations:

@ApplicationScoped
public class Example {

  @Retry
  @CircuitBreaker
  public Result getResult(String userId) {
    List<Widgets> widgets = fetchWidgets(userId);
    return new Result(userId, widgets);
  }

}


For more info:

What's Already in There?

The June Liberty beta included control over how custom X.509 certificates map to users in the user registry and submitting usage statistics from your Liberty servers to IBM Cloud Private monitoring services.

Looking for the Latest?

If you're visiting this post from the future and you're looking for the latest releases of Liberty, here are the links you're looking for:

Record growth in microservices is disrupting the operational landscape. Read the Global Microservices Trends report to learn more.

Topics:
microservices ,microprofile ,fault tolerance ,monitoring ,open liberty ,java

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}