hystrix-dropwizard-bundle

A hystrix bundle for DropWizard

License

License

Categories

Categories

DropWizard Container Microservices
GroupId

GroupId

org.zapodot
ArtifactId

ArtifactId

hystrix-dropwizard-bundle
Last Version

Last Version

1.0.2
Release Date

Release Date

Type

Type

jar
Description

Description

hystrix-dropwizard-bundle
A hystrix bundle for DropWizard
Project URL

Project URL

https://github.com/zapodot/hystrix-dropwizard-bundle
Source Code Management

Source Code Management

https://github.com/zapodot/hystrix-dropwizard-bundle

Download hystrix-dropwizard-bundle

How to add to project

<!-- https://jarcasting.com/artifacts/org.zapodot/hystrix-dropwizard-bundle/ -->
<dependency>
    <groupId>org.zapodot</groupId>
    <artifactId>hystrix-dropwizard-bundle</artifactId>
    <version>1.0.2</version>
</dependency>
// https://jarcasting.com/artifacts/org.zapodot/hystrix-dropwizard-bundle/
implementation 'org.zapodot:hystrix-dropwizard-bundle:1.0.2'
// https://jarcasting.com/artifacts/org.zapodot/hystrix-dropwizard-bundle/
implementation ("org.zapodot:hystrix-dropwizard-bundle:1.0.2")
'org.zapodot:hystrix-dropwizard-bundle:jar:1.0.2'
<dependency org="org.zapodot" name="hystrix-dropwizard-bundle" rev="1.0.2">
  <artifact name="hystrix-dropwizard-bundle" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.zapodot', module='hystrix-dropwizard-bundle', version='1.0.2')
)
libraryDependencies += "org.zapodot" % "hystrix-dropwizard-bundle" % "1.0.2"
[org.zapodot/hystrix-dropwizard-bundle "1.0.2"]

Dependencies

compile (5)

Group / Artifact Type Version
io.dropwizard : dropwizard-core jar 1.3.1
com.netflix.hystrix : hystrix-core jar 1.5.12
com.netflix.hystrix : hystrix-metrics-event-stream jar 1.5.12
com.netflix.hystrix : hystrix-codahale-metrics-publisher jar 1.5.12
org.slf4j : slf4j-api jar 1.7.25

test (5)

Group / Artifact Type Version
org.mockito : mockito-core jar 2.18.0
com.google.guava : guava jar 24.1-jre
junit : junit jar 4.12
io.dropwizard : dropwizard-client jar 1.3.1
io.dropwizard : dropwizard-testing jar 1.3.1

Project Modules

There are no modules declared in this project.

hystrix-dropwizard-bundle

Build Status Coverage Status Apache V2 License Maven Central Libraries.io for GitHub Analytics

A Hystrix bundle for DropWizard which adds a Hystrix event stream to the admin context and enables Metrics reporting of Hystrix metrics

Licence

This library is released under an Apache Licence (V2).

Why do I need it?

  • You use both DropWizard and Hystrix in your project (or are planning to..) and want your application's Hystrix metrix available in a Hystrix Dashboard (either directly or via Turbine)
  • It is easy to set up as it really requires you to add only a single line of code in your application (see example below)

Alternatives

  • If you want a even tighter integration between Hystrix and DropWizard, you should have a look at Yammer's Tenacity project. Note: Tenacity implies (but does not require) that you are using Breakerbox for managing your Hystrix runtime configuration.

Usage

This library is distributed through the Sonatype OSS Repo and should thus be widely available.

Add dependency

Maven

<dependency>
    <groupId>org.zapodot</groupId>
    <artifactId>hystrix-dropwizard-bundle</artifactId>
    <version>1.0.2</version>
</dependency>

SBT

libraryDependencies += "org.zapodot" % "hystrix-dropwizard-bundle" % "1.0.2"

Add bundle to your application

    @Override
    public void initialize(final Bootstrap<AppConfiguration> bootstrap) {
        ...
        bootstrap.addBundle(HystrixBundle.withDefaultSettings());
        ...
    }

This will initialize the bundle using default settings which means that:

  • a HystrixMetricsStreamServlet is added to the admin context of your application with servlet mapping /hystrix.stream
  • the HystrixCodaHaleMetricsPublisher is registered for Hystrix which will push all Hystrix metrics to DropWizard (previously: CodaHale) Metrics

If you need some other configuration, use the provided Builder (see example below)

    @Override
    public void initialize(final Bootstrap<AppConfiguration> bootstrap) {
        ...
        bootstrap.addBundle(HystrixBundle.builder()
                                            .withApplicationStreamPath("/my-path")
                                            .disableStreamServletInAdminContext()
                                            .disableMetricsPublisher()
                                            .build()
                                            );
        ...
    }

Overriding publishing settings

Starting with version 0.9, you may now implement your own mechanism for specifying whether Hystrix Metrics should be published to DropWizard Metrics by adding your own lambda expression to the withMetricsPublisherPredicate builder method

    HystrixBundle.builder()
                .withMetricsPublisherPredicate((c) -> true) // c is your application configuration POJO
                .build();

Note: The now defunct version 0.8 implemented another approach which included overriding a method on Hystrix bundle. Putting this on the builder allows us to keep the specialized constructor private which provides us with more flexibility in the future.

Versions

Version
1.0.2
1.0.1
1.0.0
0.9.2
0.9.1
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1