Endpoint library for the failsafe framework

Overview

Codacy Badge Build Status Maven Central

Failsafe Actuator

Failsafe Actuator is a Java library that provides a simple monitoring interface for Spring Boot applications that use the Failsafe library. Using Failsafe Actuator will readily expose the state of your Circuit Breakers (closed, open, half-open) to your Spring Actuator endpoint without additional effort.

Core Technical Concepts/Inspiration

Failsafe Actuator supports Spring's dependency injection to make it easier to use Failsafe. It allows you to monitor the state of your Circuit Breakers so that, whenever a third party that your app relies upon suddenly becomes unavailable, you can discover it immediately and take action. This is essential for applications used in production.

Development Status/Project Roadmap

This library is currently under development and used in production at Zalando.

Find more details about our development plans in the Issues Tracker.

We're always looking for contributors, so if you find an interesting "Help Wanted" issue then please drop us a line in the related issue to claim it and begin working.

Unless you explicitly state otherwise in advance, any non trivial contribution intentionally submitted for inclusion in this project by you to the steward of this repository (Zalando SE, Berlin) shall be under the terms and conditions of the MIT License, without any additional copyright information, terms or conditions.

Getting Started

Dependencies/Requirements

Running/Using

To use Failsafe Actuator, add the following dependency to your project:

Gradle:

compile("org.zalando:failsafe-actuator:${FAILSAFE-ACTUATOR-VERSION}")

Maven:

<dependency>
    <groupId>org.zalando</groupId>
    <artifactId>failsafe-actuator</artifactId>
    <version>${failsafe-actuator.version}</version>
</dependency>

Create your CircuitBreaker by defining them as a Bean.

@Configuration
public class CircuitBreakerConfiguration {
  @Bean
  public CircuitBreaker myBreaker() {
    return new CircuitBreaker();
  }
}

You can use and configure the created CircuitBreaker by autowiring it in the class where it should be used.

@Component
public class MyBean {
    @Autowired
    private CircuitBreaker myBreaker;
}

That's it. By calling the endpoint via http://${yourAddress}/actuator/circuit-breakers. you will get a response which looks like the following:

GET /actuator/circuit-breakers

HTTP/1.1 200
Content-Type: application/json

{
  "myBreaker": {
    "state": "OPEN"
  },
  "otherBreaker": {
    "state": "CLOSED"
  }
}

Individual circuit breakers can be requested via /acutuator/circuit-breakers/{name}:

GET /actuator/circuit-breakers/myBreaker

HTTP/1.1 200
Content-Type: application/json

{
  "state": "OPEN"
}

You can even modify the circuit breaker state and manually open or close them:

POST /actuator/circuit-breakers/myBreaker
Content-Type: application/json

{
  "state": "CLOSED"
}

Example usage

To see a complete example on how to use the library take a look at the Sample Application. It starts a Rest Controller that shows how to autowire CircuitBreaker into your application and configure them.

How to build on your own

In order to build the JAR on your own run the following command:

mvn clean install

License

This code is released under the MIT license. See License.

Comments
  • Improvement/use spring context

    Improvement/use spring context

    Change the way how the library is working.

    In general there is no need for having the CircuitBreakerRegistry and we could rather rely on Springs ApplicationContext.

    In order to keep the lib backwards compatible and give others the chance to migrate I only marked the CircuitBreakerRegistry as @Deprecated.

    Open tasks:

    • [x] Add Unit Tests
    • [x] Update Readme
    • [x] Update Example project
    opened by MALPI 12
  • Add support for Spring Boot 2.x

    Add support for Spring Boot 2.x

    The current version is not compatible with Spring Boot 2.x as e.g. FailsafeAutoConfiguration is relying on org.springframework.boot.bind.RelaxedPropertyResolver which is removed in Spring Boot 2.x

    help wanted hacktoberfest 
    opened by duergner 11
  • Feature/spring boot 2 create example module

    Feature/spring boot 2 create example module

    Fixes #54 A port of the sample application to the spring-boot-2 feature branch.

    Could the label 'hacktoberfest' be added to this issue? (since my contribution is in the spirit of Hacktoberfest 2017).

    opened by robvanderleek 9
  • Enhancement/breaker config

    Enhancement/breaker config

    This PR adds application properties configurable breakers.

    At the moment it supports timeout, delay, success threshold, failure threshold.

    Further configs can be easily added in the future.

    This PR is based on ehancement/method-annotation

    opened by coders-kitchen 8
  • changed output of endpoint to a more monitoring friendly solution.

    changed output of endpoint to a more monitoring friendly solution.

    Hi,

    we just started to use your lib for our production system and we really love it :) One small thing we are missing is a more monitoring friendly output to the endpoint.

    I changed the output in a way that you can reference each breaker by a name and not just by a (not guaranteed) ordering in a list.

    Also one question: why do you use the failsafe endpoint for cleaning up the registry? I didn't want to change that much, though.. If you want I can also work on this in a future PR.

    Greetings from an ex Zalando :wave:

    opened by JonasJurczok 6
  • Create example module

    Create example module

    Fixes #41

    Hi maintainers, This is my first PR to your project in the spirit of Hacktoberfest 2017. I've restructured the codebase into a Maven multi-module project with 'library' and 'sample' modules. Let me know if this is what you had in mind. I might have broken the Gradle build or the deploy phase. Small question: is it necessary to have the license in all code files since there's already a LICENSE file?

    opened by robvanderleek 6
  • #43: Add support for Spring Boot 2.x

    #43: Add support for Spring Boot 2.x

    • Added support for Spring Boot 2.x (2.0.0.M5)
    • RelaxedPropertyResolver has been removed in Spring Boot 2. Instead it was advised that properties should be read directly from the environment using uniform format (Ref: https://github.com/spring-projects/spring-boot/wiki/Relaxed-Binding-2.0)
    • Spring Boot 2 made some significant changes to Actuator endpoints. The endpoints are now prefixed with "application", and in order to implement custom actuator endpoints they need to be annotated as @Endpoint. (Ref: https://spring.io/blog/2017/08/22/introducing-actuator-endpoints-in-spring-boot-2-0)
    • Updated README.md
      • Updated Spring Boot version
      • Updated the failsafe actuator endpoint
    opened by vpondala 6
  • Upgraded to Spring Boot 2.0.0.RELEASE

    Upgraded to Spring Boot 2.0.0.RELEASE

    • Removed milestone repository configuration
    • Endpoint exposure configuration has been changed (again) in 2.0.0.RC2/RELEASE, hence updated sample's application.properties accordingly.

    Ref: https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.0.0-RC2-Release-Notes#configuration-key-harmonization

    Related issue: #43, #70

    opened by vpondala 5
  • Create example module

    Create example module

    Separate the FailsafeSampleApp from the library by moving it to a dedicated module.

    It would be nice to have an example Application which one can checkout and run locally. By curling on localhost:8080/failsafe, output of the actuator can be seen. Furthermore one could easily see how to use the lib.

    enhancement help wanted hacktoberfest 
    opened by MALPI 5
  • Enhancement/gather statistics

    Enhancement/gather statistics

    Fixes #23

    WIP Extends Failsafe Actuator by the feature to provide failure/success metrics for the used Circuit Breakers.

    Still open:

    • Add duration of a call
    • extend Readme.md.
    opened by MALPI 5
  • CircuitBreakerRegistry.getOrCreate() implementation matches documentation

    CircuitBreakerRegistry.getOrCreate() implementation matches documentation

    It checks whether there is already a circuit breaker registered with that name and returns the existing one if existing. Otherwise a new one is created as was done previously as well.

    This fixes #21

    opened by duergner 5
  • Bump spring-boot-starter-web from 2.0.5.RELEASE to 2.5.12

    Bump spring-boot-starter-web from 2.0.5.RELEASE to 2.5.12

    Bumps spring-boot-starter-web from 2.0.5.RELEASE to 2.5.12.

    Release notes

    Sourced from spring-boot-starter-web's releases.

    v2.5.12

    :lady_beetle: Bug Fixes

    • MustacheAutoConfiguration in a Servlet web application fails with a ClassNotFoundException when Spring MVC is not on the classpath #30456

    :notebook_with_decorative_cover: Documentation

    • Javadoc of org.springframework.boot.gradle.plugin.ResolveMainClassName.setClasspath(Object) is inaccurate #30468
    • Document that @DefaultValue can be used on a record component #30460

    :hammer: Dependency Upgrades

    • Upgrade to Jackson Bom 2.12.6.20220326 #30477
    • Upgrade to Spring Framework 5.3.18 #30491

    :heart: Contributors

    We'd like to thank all the contributors who worked on this release!

    v2.5.11

    :star: New Features

    • Add EIGHTEEN to JavaVersion enum #29524

    :lady_beetle: Bug Fixes

    • Thymeleaf auto-configuration in a reactive application can fail due to duplicate templateEngine beans #30384
    • ConfigurationPropertyName#equals is not symmetric when adapt has removed trailing characters from an element #30317
    • server.tomcat.keep-alive-timeout is not applied to HTTP/2 #30267
    • Setting spring.mustache.enabled to false has no effect #30250
    • bootWar is configured eagerly #30211
    • Actuator @ReadOperation on Flux cancels request after first element emitted #30095
    • No metrics are bound for R2DBC ConnectionPools that have been wrapped #30090
    • Unnecessary allocations in Prometheus scraping endpoint #30085
    • Condition evaluation report entry for a @ConditionalOnSingleCandidate that does not match due to multiple primary beans isn't as clear as it could be #30073
    • Generated password are logged without an "unsuitable for production use" note #30061
    • Files in META-INF are not found when deploying a Gradle-built executable war to a servlet container #30026
    • spring-boot-configuration-processor fails compilation due to @DefaultValue with a long value and generates invalid metadata for byte and short properties with out-of-range default values #30020
    • Dependency management for Netty tcNative is incomplete leading to possible version conflicts #30010
    • Dependency management for Apache Kafka is incomplete #29023

    :notebook_with_decorative_cover: Documentation

    • Fix JsonSerializer example in reference guide #30329
    • Default value of spring.thymeleaf.reactive.media-types is not documented #30280
    • Add Netty in "Enable HTTP Response Compression" #30234

    ... (truncated)

    Commits
    • 35105a0 Release v2.5.12
    • 17936b8 Polish
    • 94c40c7 Upgrade to Spring Framework 5.3.18
    • 2e90fd2 Upgrade CI to Docker 20.10.14
    • 6cded5b Upgrade Java 18 version in CI image
    • 06c5e26 Upgrade to Jackson Bom 2.12.6.20220326
    • c0c32d8 Merge pull request #30456 from candrews
    • 8cb11b7 Polish "Make MustacheViewResolver bean back off without Spring MVC"
    • 7101b50 Make MustacheViewResolver bean back off without Spring MVC
    • 05b7bef Fix javadoc of ResolveMainClassName setClasspath(Object)
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Bump commons-io from 2.6 to 2.7

    Bump commons-io from 2.6 to 2.7

    Bumps commons-io from 2.6 to 2.7.

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Bump junit from 4.12 to 4.13.1

    Bump junit from 4.12 to 4.13.1

    Bumps junit from 4.12 to 4.13.1.

    Release notes

    Sourced from junit's releases.

    JUnit 4.13.1

    Please refer to the release notes for details.

    JUnit 4.13

    Please refer to the release notes for details.

    JUnit 4.13 RC 2

    Please refer to the release notes for details.

    JUnit 4.13 RC 1

    Please refer to the release notes for details.

    JUnit 4.13 Beta 3

    Please refer to the release notes for details.

    JUnit 4.13 Beta 2

    Please refer to the release notes for details.

    JUnit 4.13 Beta 1

    Please refer to the release notes for details.

    Commits
    • 1b683f4 [maven-release-plugin] prepare release r4.13.1
    • ce6ce3a Draft 4.13.1 release notes
    • c29dd82 Change version to 4.13.1-SNAPSHOT
    • 1d17486 Add a link to assertThrows in exception testing
    • 543905d Use separate line for annotation in Javadoc
    • 510e906 Add sub headlines to class Javadoc
    • 610155b Merge pull request from GHSA-269g-pwp5-87pp
    • b6cfd1e Explicitly wrap float parameter for consistency (#1671)
    • a5d205c Fix GitHub link in FAQ (#1672)
    • 3a5c6b4 Deprecated since jdk9 replacing constructor instance of Double and Float (#1660)
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 1
Owner
Zalando SE
The org page for Zalando, Europe's leading online fashion platform. Visit opensource.zalando.com for project stats.
Zalando SE
Publish Jenkins performances metrics to an OpenTelemetry endpoint, including distributed traces of job executions and health metrics of the controller.

OpenTelemetry Introduction Architecture Features Getting Started Examples Configuration as Code Contributing Introduction Collect Jenkins monitoring d

Jenkins 73 Dec 26, 2022
Consume an async api (with callback) from sync endpoint using vert.x

vertx-async-to-sync Problem statement Suppose we have two services - A and B. In a trivial and everyday scenario, client makes request to A. A then do

Tahniat Ashraf Priyam 12 Oct 19, 2022
POC showing how to divide endpoint(s) among different Open-API screens

Multiple Open-API groups: Spring boot POC showing how to divide endpoint(s) among different Open-API screens Demo Link (Select definition from top rig

null 6 Dec 15, 2022
A minimal WHIP implementation for the Raspberry Pi. It sends Mic and Camera to a WHIP endpoint

whipi A minimal WHIP implementation for the Raspberry Pi. It sends Camera Mic to a WHIP endpoint. Requires a Raspberry Pi with a PiCam and Java 11. It

|pipe| 12 Oct 27, 2022
Jiskord is a selfbot wrapper for Discord with almost every API endpoint accessible

Jiskord Jiskord is a selfbot wrapper for Discord with almost every API endpoint accessible. This library is inspired by Discum. It is made using Java

Vinesh Rajpurohit 5 Feb 28, 2022
Tool for providing an HTTP endpoint to retrieve predefined aggregations on metrics of an InfluxDB.

InfluxDB DWH Exporter This application provides an HTTP endpoint that can deliver metrics from an InfluxDB in an aggregated form when called. This can

Novatec Consulting GmbH 1 Jan 18, 2022
💡极致性能的企业级Java服务器框架,RPC,游戏服务器框架,web应用服务器框架。(Extreme fast enterprise Java server framework, can be RPC, game server framework, web server framework.)

?? 为性能而生的万能服务器框架 ?? Ⅰ. zfoo简介 ?? 性能炸裂,天生异步,Actor设计思想,无锁化设计,基于Spring的MVC式用法的万能RPC框架 极致序列化,原生集成的目前二进制序列化和反序列化速度最快的 zfoo protocol 作为网络通讯协议 高可拓展性,单台服务器部署,

null 1k Jan 1, 2023
Google Mr4c GNU Lesser 3 Google Mr4c MR4C is an implementation framework that allows you to run native code within the Hadoop execution framework. License: GNU Lesser 3, .

Introduction to the MR4C repo About MR4C MR4C is an implementation framework that allows you to run native code within the Hadoop execution framework.

Google 911 Dec 9, 2022
Lattice is a powerful, lightweight business extension invoke framework. By using the Lattice framework, complex business customization can be efficiently organized and managed.

Lattice Framework Introduction Lattice is a powerful, lightweight business extension invoke framework. By using the Lattice framework, complex busines

null 41 Dec 30, 2022
Duck Library is a library for developers who don't want to spend their time to write same library consistently.

Duck Library is a library for developers who don't want to spend their time to write same library consistently. It has almost every useful feature to

null 5 Jul 28, 2022
The foundational library of the Morpheus data science framework

Introduction The Morpheus library is designed to facilitate the development of high performance analytical software involving large datasets for both

Zavtech Systems 226 Dec 20, 2022
Telegram API Client and Telegram BOT API Library and Framework in Pure java.

Javagram Telegram API Client and Telegram Bot API library and framework in pure Java. Hello Telegram You can use Javagram for both Telegram API Client

Java For Everything 3 Oct 17, 2021
An advanced and highly optimized Java library to build framework

An advanced and highly optimized Java library to build frameworks: it's useful for scanning class paths, generating classes at runtime, facilitating the use of reflection, scanning the filesystem, executing stringified source code and much more...

Burningwave 119 Dec 21, 2022
[WIP] Springram is uber library for working with Telegram using Spring Framework and Spring Boot.

Springram Springram is a library for working with telegram using the spring framework and spring boot. This library gives you the ability to use contr

Max 6 Nov 1, 2022
This project is a simple messaging application made using React-Native framework, Gifted-Chat library and Firebase database

This project is a simple messaging application made using React-Native framework, Gifted-Chat library and Firebase database. The example that will be shown here focuses on the ability of two people to message each other in a chat room.

null 3 Jan 30, 2022
An API Library that provides the functionality to access, manage and store device topologies found in JSON files using Java and Maven Framework

Topology API ?? About An API library which provides the functionality to access, manage and store device topologies. ?? Description Read a topology fr

Abdelrahman Hamdy 2 Aug 4, 2022
Application for creating blog posts, developed with Java using Spring Framework for backend and Angular along with PrimeNG Library for frontend development.

Application for creating blog posts, developed with Java using Spring Framework for backend and Angular along with PrimeNG Library for frontend development.

Áureo Carmelino 10 Nov 27, 2022
Tinker is a hot-fix solution library for Android, it supports dex, library and resources update without reinstall apk.

Tinker Tinker is a hot-fix solution library for Android, it supports dex, library and resources update without reinstalling apk. Getting started Add t

Tencent 16.6k Dec 30, 2022
Diff Utils library is an OpenSource library for performing the comparison / diff operations between texts or some kind of data: computing diffs

Diff Utils library is an OpenSource library for performing the comparison / diff operations between texts or some kind of data: computing diffs, applying patches, generating unified diffs or parsing them, generating diff output for easy future displaying (like side-by-side view) and so on.

null 951 Jan 5, 2023
This is an automated library software built in Java Netbeans to reduce manual efforts of the librarian, students to ensure smooth functioning of library by involving RFIDs.

Advanced-Library-Automation-System This is an advanced automated library software built in Java Netbeans to reduce manual efforts of the librarian, st

DEV_FINWIZ 14 Dec 6, 2022