Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tushar-naik/dropwizard-hystrix-tracker
A Bundle that can be used to track Paths/Resources
https://github.com/tushar-naik/dropwizard-hystrix-tracker
client-filter dropwizard-bundle hystrix tracker
Last synced: 17 days ago
JSON representation
A Bundle that can be used to track Paths/Resources
- Host: GitHub
- URL: https://github.com/tushar-naik/dropwizard-hystrix-tracker
- Owner: Tushar-Naik
- License: apache-2.0
- Created: 2017-03-21T11:51:01.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2020-10-12T23:50:45.000Z (over 4 years ago)
- Last Synced: 2024-11-09T05:39:33.336Z (2 months ago)
- Topics: client-filter, dropwizard-bundle, hystrix, tracker
- Language: Java
- Size: 224 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Dropwizard Hystrix Tracker
[![Build Status](https://travis-ci.org/Tushar-Naik/dropwizard-hystrix-tracker.svg?branch=master)](https://travis-ci.org/Tushar-Naik/dropwizard-hystrix-tracker)
[![Coverage Status](https://coveralls.io/repos/github/Tushar-Naik/dropwizard-hystrix-tracker/badge.svg?branch=master)](https://coveralls.io/github/Tushar-Naik/dropwizard-hystrix-tracker?branch=master)
[![Apache V2 License](http://img.shields.io/badge/license-Apache%20V2-blue.svg)](//github.com/Tushar-Naik/dropwizard-hystrix-tracker/blob/master/LICENSE)
[![Clojars Project](https://img.shields.io/clojars/v/io.dropwizard.tracker/dropwizard-hystrix-tracker.svg)](https://clojars.org/io.dropwizard.tracker/dropwizard-hystrix-tracker)#### A Bundle that can be used to track API-Paths / Resources
A precompiled bundle for tracking/monitoring your favourite API-Paths/Resources.
There are 2 features here:
1. Client Restriction for certain API Paths within your Resource - using annotation ```@ClientRestriction```
2. Hystrix tracking of APIs - using annotation ```@TrackPath```
## Usage
### Build instructions
- Cloning source code:git clone github.com/Tushar-Naik/dropwizard-hystrix-tracker.git
- Building code
mvn install
### Repository
```clojars
Clojars repository
https://clojars.org/repo```
### Maven Dependency
* Use the following maven dependency for path tracker:
```io.dropwizard.tracker
dropwizard-hystrix-path-tracker
1.3.12-1```
* Use the following maven dependency for client filter:
```io.dropwizard.tracker
dropwizard-client-filter
1.3.12-1```
## 1. Using Path Tracker Bundle
Use this to track a particular API endpoint.
Hystrix metrics will be emitted based on the name of the API.
#### Bootstrap
```java
@Override
public void initialize(final Bootstrap...) {
bootstrap.addBundle(new TrackerBundle());
}
```
#### Tracking your Resource
```java
@Path("/service/v1")
@Slf4j
public class MyResource{
@Path("/api1")
@GET
@Produces(MediaType.APPLICATION_JSON)
@TrackPath("/service/*")
public Response getResponse() {
...
}
...
}
```
![alt tag](images/hystrix-dashboard-sample.png?raw=true "Sample Hystrix Dashboard")## 2. Using Client Restriction Bundle
Depending on the ```ClientFilterConfig``` provided,
if a Resource Path is marked with the annotation
```@ClientRestriction```,
API will return a **STATUS:403 FORBIDDEN** if header in the incoming Request is not present,
or does not match the ones present in ```ClientFilterConfig.validClients```
#### Bootstrap
```java
@Override
public void initialize(final Bootstrap bootstrap) {
bootstrap.addBundle(new ClientFilterBundle() {
@Override
public ClientFilterConfig getClientFilterConfig(XYZConfiguration xYZConfiguration) {
return xYZConfiguration.getClientFilterConfig();
}
});
}
```
#### Adding client header restriction for a resource
```java
@Path("/service/v1")
@Slf4j
public class MyResource{
@Path("/api/{path}/search")
@GET
@Produces(MediaType.APPLICATION_JSON)
@ClientRestriction
public Response getResponse() {
...
}
...
}
```